From 6378acc3179144088ede218f470414f28832ece4 Mon Sep 17 00:00:00 2001 From: Stefano Scafiti Date: Tue, 15 Jul 2025 10:57:33 +0200 Subject: [PATCH 1/2] Add field to ToolsInputSchema --- mcp/tools.go | 1 + 1 file changed, 1 insertion(+) diff --git a/mcp/tools.go b/mcp/tools.go index 3e3931b09..c13b607fc 100644 --- a/mcp/tools.go +++ b/mcp/tools.go @@ -516,6 +516,7 @@ func (t Tool) MarshalJSON() ([]byte, error) { } type ToolInputSchema struct { + Defs map[string]any `json:"$defs,omitempty"` Type string `json:"type"` Properties map[string]any `json:"properties,omitempty"` Required []string `json:"required,omitempty"` From ca63715965f9c1ef3fab9c3c505ffed2f65a54e5 Mon Sep 17 00:00:00 2001 From: Stefano Scafiti Date: Tue, 15 Jul 2025 11:39:12 +0200 Subject: [PATCH 2/2] Update MarshalJSON() --- mcp/tools.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mcp/tools.go b/mcp/tools.go index c13b607fc..38a33a251 100644 --- a/mcp/tools.go +++ b/mcp/tools.go @@ -527,6 +527,10 @@ func (tis ToolInputSchema) MarshalJSON() ([]byte, error) { m := make(map[string]any) m["type"] = tis.Type + if tis.Defs != nil { + m["$defs"] = tis.Defs + } + // Marshal Properties to '{}' rather than `nil` when its length equals zero if tis.Properties != nil { m["properties"] = tis.Properties