File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ func (t Tool) MarshalJSON() ([]byte, error) {
105
105
106
106
type ToolInputSchema struct {
107
107
Type string `json:"type"`
108
- Properties map [string ]interface {} `json:"properties,omitempty "`
108
+ Properties map [string ]interface {} `json:"properties"`
109
109
Required []string `json:"required,omitempty"`
110
110
}
111
111
Original file line number Diff line number Diff line change @@ -142,3 +142,24 @@ func TestUnmarshalToolWithoutRawSchema(t *testing.T) {
142
142
assert .Empty (t , toolUnmarshalled .InputSchema .Required )
143
143
assert .Empty (t , toolUnmarshalled .RawInputSchema )
144
144
}
145
+
146
+ func TestMarshalToolWithoutInputSchemaProperties (t * testing.T ) {
147
+ tool := NewTool ("empty-input-schema-tool" ,
148
+ WithDescription ("A tool with no input schema properties" ),
149
+ )
150
+
151
+ data , err := json .Marshal (tool )
152
+ assert .Nil (t , err )
153
+
154
+ expected := json .RawMessage (`{
155
+ "description": "A tool with no input schema properties",
156
+ "inputSchema": {
157
+ "type": "object",
158
+ "properties": {}
159
+ },
160
+ "name": "empty-input-schema-tool"
161
+ }
162
+ ` )
163
+
164
+ assert .JSONEq (t , string (expected ), string (data ))
165
+ }
You can’t perform that action at this time.
0 commit comments