Skip to content

Commit 8c50299

Browse files
committed
Added 'Definitions' field to 'ToolInputSchema'
1 parent 8f5b048 commit 8c50299

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

mcp/tools.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,10 @@ func (t Tool) MarshalJSON() ([]byte, error) {
516516
}
517517

518518
type ToolInputSchema struct {
519-
Type string `json:"type"`
520-
Properties map[string]any `json:"properties,omitempty"`
521-
Required []string `json:"required,omitempty"`
519+
Type string `json:"type"`
520+
Properties map[string]any `json:"properties,omitempty"`
521+
Required []string `json:"required,omitempty"`
522+
Definitions map[string]ToolInputSchema `json:"$defs,omitempty"`
522523
}
523524

524525
// MarshalJSON implements the json.Marshaler interface for ToolInputSchema.
@@ -535,6 +536,10 @@ func (tis ToolInputSchema) MarshalJSON() ([]byte, error) {
535536
m["required"] = tis.Required
536537
}
537538

539+
if len(tis.Definitions) > 0 {
540+
m["$defs"] = tis.Definitions
541+
}
542+
538543
return json.Marshal(m)
539544
}
540545

0 commit comments

Comments
 (0)