From 0d8fb21844658f23d432c9a0cb9f21962bd6b1ca Mon Sep 17 00:00:00 2001 From: David Gageot Date: Mon, 29 Sep 2025 17:29:36 +0200 Subject: [PATCH] Start supporting output schemas Signed-off-by: David Gageot --- pkg/tools/mcp/client.go | 5 +++++ pkg/tools/tools.go | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pkg/tools/mcp/client.go b/pkg/tools/mcp/client.go index b320b5a7a..81aed0d79 100644 --- a/pkg/tools/mcp/client.go +++ b/pkg/tools/mcp/client.go @@ -151,6 +151,11 @@ func (c *Client) ListTools(ctx context.Context, toolFilter []string) ([]tools.To IdempotentHint: t.Annotations.IdempotentHint, OpenWorldHint: t.Annotations.OpenWorldHint, }, + OutputSchema: tools.ToolOutputSchema{ + Type: t.OutputSchema.Type, + Properties: t.OutputSchema.Properties, + Required: t.OutputSchema.Required, + }, }, } toolsList = append(toolsList, tool) diff --git a/pkg/tools/tools.go b/pkg/tools/tools.go index f714a1c76..007f2f8c7 100644 --- a/pkg/tools/tools.go +++ b/pkg/tools/tools.go @@ -32,11 +32,12 @@ type Tool struct { } type FunctionDefinition struct { - Name string `json:"name"` - Description string `json:"description,omitempty"` - Strict bool `json:"strict,omitempty"` - Parameters FunctionParameters `json:"parameters"` - Annotations ToolAnnotation `json:"annotations"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + Strict bool `json:"strict,omitempty"` + Parameters FunctionParameters `json:"parameters"` + Annotations ToolAnnotation `json:"annotations"` + OutputSchema ToolOutputSchema `json:"outputSchema"` } type ToolAnnotation struct { @@ -47,6 +48,12 @@ type ToolAnnotation struct { OpenWorldHint *bool `json:"openWorldHint,omitempty"` } +type ToolOutputSchema struct { + Type string `json:"type"` + Properties map[string]any `json:"properties,omitempty"` + Required []string `json:"required,omitempty"` +} + type FunctionParameters struct { Type string `json:"type"` Properties map[string]any `json:"properties"`