Skip to content

Commit 3246d9c

Browse files
committed
mcp - output mcp tool schema as raw json
1 parent 2835e8c commit 3246d9c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cmd/src/mcp.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,20 @@ func mcpMain(args []string) error {
9494
}
9595

9696
func printSchemas(tool *mcp.ToolDef) error {
97-
input, err := json.Marshal(tool.InputSchema)
98-
if err != nil {
99-
return err
97+
var schema = struct {
98+
Name string `json:"tool"`
99+
Input any `json:"inputSchema"`
100+
Output any `json:"outputSchema"`
101+
}{
102+
Name: tool.Name,
103+
Input: tool.InputSchema,
104+
Output: tool.OutputSchema,
100105
}
101-
output, err := json.Marshal(tool.OutputSchema)
106+
jsonVal, err := json.Marshal(schema)
102107
if err != nil {
103108
return err
104109
}
105-
106-
fmt.Printf("Input:\n%v\nOutput:\n%v\n", string(input), string(output))
110+
fmt.Println(string(jsonVal))
107111
return nil
108112
}
109113

0 commit comments

Comments
 (0)