@@ -10,6 +10,7 @@ import (
1010
1111 // Packages
1212 sdkmcp "github.com/modelcontextprotocol/go-sdk/mcp"
13+ llm "github.com/mutablelogic/go-llm"
1314 homeassistant "github.com/mutablelogic/go-llm/homeassistant/connector"
1415 schema "github.com/mutablelogic/go-llm/kernel/schema"
1516 mock "github.com/mutablelogic/go-llm/mcp/mock"
@@ -285,6 +286,29 @@ func TestAddToolsBadInputSchema(t *testing.T) {
285286 }
286287}
287288
289+ type nilInputSchemaTool struct {}
290+
291+ func (nilInputSchemaTool ) Name () string { return "nil_input_schema" }
292+ func (nilInputSchemaTool ) Description () string { return "tool with nil input schema" }
293+ func (nilInputSchemaTool ) InputSchema () * jsonschema.Schema { return nil }
294+ func (nilInputSchemaTool ) OutputSchema () * jsonschema.Schema {
295+ return nil
296+ }
297+ func (nilInputSchemaTool ) Meta () llm.ToolMeta { return llm.ToolMeta {} }
298+ func (nilInputSchemaTool ) Run (context.Context , json.RawMessage ) (any , error ) {
299+ return map [string ]any {"ok" : true }, nil
300+ }
301+
302+ func TestAddToolsNilInputSchemaDefaultsToEmptyObject (t * testing.T ) {
303+ srv , err := server .New ("test-server" , "1.0.0" )
304+ if err != nil {
305+ t .Fatal (err )
306+ }
307+ if err := srv .AddTools (nilInputSchemaTool {}); err != nil {
308+ t .Fatalf ("expected nil input schema to be accepted, got error: %v" , err )
309+ }
310+ }
311+
288312///////////////////////////////////////////////////////////////////////////////
289313// TESTS — Session context injection (T6)
290314
0 commit comments