Skip to content

Commit 5ad6c8d

Browse files
authored
Add defs field to ToolsInputSchema (#488)
* Add field to ToolsInputSchema * Update MarshalJSON()
1 parent 3964d51 commit 5ad6c8d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mcp/tools.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ func (t Tool) MarshalJSON() ([]byte, error) {
585585
}
586586

587587
type ToolInputSchema struct {
588+
Defs map[string]any `json:"$defs,omitempty"`
588589
Type string `json:"type"`
589590
Properties map[string]any `json:"properties,omitempty"`
590591
Required []string `json:"required,omitempty"`
@@ -595,6 +596,10 @@ func (tis ToolInputSchema) MarshalJSON() ([]byte, error) {
595596
m := make(map[string]any)
596597
m["type"] = tis.Type
597598

599+
if tis.Defs != nil {
600+
m["$defs"] = tis.Defs
601+
}
602+
598603
// Marshal Properties to '{}' rather than `nil` when its length equals zero
599604
if tis.Properties != nil {
600605
m["properties"] = tis.Properties

0 commit comments

Comments
 (0)