mcp-go icon indicating copy to clipboard operation
mcp-go copied to clipboard

feature:support output schema in tools

Open koh-osug opened this issue 5 months ago • 2 comments

Problem Statement

I get better results when an output schema is supported for tools: https://modelcontextprotocol.io/specification/2025-06-18/schema#tool

Right now it is not supported:

https://github.com/mark3labs/mcp-go/blob/main/mcp/tools.go

Proposed Solution

Add the output schema to the tools struct and process it.

MCP Spec Reference

Tool

interface Tool {
  [_meta](https://modelcontextprotocol.io/specification/2025-06-18/schema#tool-_meta)?: { [key: string]: unknown };
  [annotations](https://modelcontextprotocol.io/specification/2025-06-18/schema#tool-annotations)?: [ToolAnnotations](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations);
  [description](https://modelcontextprotocol.io/specification/2025-06-18/schema#tool-description)?: string;
  [inputSchema](https://modelcontextprotocol.io/specification/2025-06-18/schema#tool-inputschema): {
    properties?: { [key: string]: object };
    required?: string[];
    type: “object”;
  };
  [name](https://modelcontextprotocol.io/specification/2025-06-18/schema#tool-name): string;
  [outputSchema](https://modelcontextprotocol.io/specification/2025-06-18/schema#tool-outputschema)?: {
    properties?: { [key: string]: object };
    required?: string[];
    type: “object”;
  };
  [title](https://modelcontextprotocol.io/specification/2025-06-18/schema#tool-title)?: string;
}

koh-osug avatar Jul 16 '25 01:07 koh-osug

looks like this is fixed https://github.com/mark3labs/mcp-go/commit/b9243915a8c31a0865d52a6df70c05bffe9ac170

jaredly avatar Sep 15 '25 19:09 jaredly

looks good, but I have no test project handy for this right now.

koh-osug avatar Sep 15 '25 22:09 koh-osug