Skip to content

Commit aed9d31

Browse files
authored
Merge pull request #350 from dgageot/output-schemas
Start supporting output schemas
2 parents bc4e079 + 0d8fb21 commit aed9d31

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

pkg/tools/mcp/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ func (c *Client) ListTools(ctx context.Context, toolFilter []string) ([]tools.To
151151
IdempotentHint: t.Annotations.IdempotentHint,
152152
OpenWorldHint: t.Annotations.OpenWorldHint,
153153
},
154+
OutputSchema: tools.ToolOutputSchema{
155+
Type: t.OutputSchema.Type,
156+
Properties: t.OutputSchema.Properties,
157+
Required: t.OutputSchema.Required,
158+
},
154159
},
155160
}
156161
toolsList = append(toolsList, tool)

pkg/tools/tools.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ type Tool struct {
3232
}
3333

3434
type FunctionDefinition struct {
35-
Name string `json:"name"`
36-
Description string `json:"description,omitempty"`
37-
Strict bool `json:"strict,omitempty"`
38-
Parameters FunctionParameters `json:"parameters"`
39-
Annotations ToolAnnotation `json:"annotations"`
35+
Name string `json:"name"`
36+
Description string `json:"description,omitempty"`
37+
Strict bool `json:"strict,omitempty"`
38+
Parameters FunctionParameters `json:"parameters"`
39+
Annotations ToolAnnotation `json:"annotations"`
40+
OutputSchema ToolOutputSchema `json:"outputSchema"`
4041
}
4142

4243
type ToolAnnotation struct {
@@ -47,6 +48,12 @@ type ToolAnnotation struct {
4748
OpenWorldHint *bool `json:"openWorldHint,omitempty"`
4849
}
4950

51+
type ToolOutputSchema struct {
52+
Type string `json:"type"`
53+
Properties map[string]any `json:"properties,omitempty"`
54+
Required []string `json:"required,omitempty"`
55+
}
56+
5057
type FunctionParameters struct {
5158
Type string `json:"type"`
5259
Properties map[string]any `json:"properties"`

0 commit comments

Comments
 (0)