Skip to content

Commit 48061fe

Browse files
authored
marshal empty properties map as empty object (#59)
Some MCP clients want a "properties" keyword on a tool schema, even if it is empty. For an example, see golang/go#76777. This PR makes an empty map in Schema.Properties marshal as "{}" instead of omitting it. Technically, this is a breaking change, but it is extremely unlikely that it will matter to anyone (except in a good way).
1 parent eb36139 commit 48061fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jsonschema/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ type Schema struct {
101101
MaxProperties *int `json:"maxProperties,omitempty"`
102102
Required []string `json:"required,omitempty"`
103103
DependentRequired map[string][]string `json:"dependentRequired,omitempty"`
104-
Properties map[string]*Schema `json:"properties,omitempty"`
104+
Properties map[string]*Schema `json:"properties"`
105105
PatternProperties map[string]*Schema `json:"patternProperties,omitempty"`
106106
AdditionalProperties *Schema `json:"additionalProperties,omitempty"`
107107
PropertyNames *Schema `json:"propertyNames,omitempty"`

0 commit comments

Comments
 (0)