Skip to content

fix(mcp): send empty properties for tools without arguments - #82

Merged
mudler merged 1 commit into
mudler:mainfrom
mudler-agent:fix/mcp-nil-properties
Sep 28, 2026
Merged

mudler merged 1 commit into
mudler:mainfrom
mudler-agent:fix/mcp-nil-properties

Conversation

@mudler-agent

Copy link
Copy Markdown
Contributor

An MCP tool that takes no arguments has no properties in its input schema, so the unmarshal leaves the property map nil. Before #81 the tool was sent as a jsonschema.Definition, whose MarshalJSON encodes a nil map as {}. mcpToolParameters has no such hook, so the tool went out as:

{"type":"object","properties":null}

vLLM validates every tool schema and rejects the whole request with a 400, so one argument-less MCP tool breaks every call:

Tool 38 function has invalid 'parameters' schema: None is not of type 'object'

Strict mode was not affected, because it already fills in an empty properties object.

Tool() now sends an empty object when the map is nil. mcp_params_test.go covers it: it fails on main with {"type":"object","properties":null} and passes with the fix.

Testing: go test . -ginkgo.label-filter='!e2e' and go vet . pass.

🤖 Generated with Claude Code

An MCP tool that takes no arguments has no "properties" in its input
schema, so the unmarshal leaves the property map nil. Before mudler#81 the
tool was sent as a jsonschema.Definition, whose MarshalJSON encodes a
nil map as {}. mcpToolParameters has no such hook, so the tool went out
with "properties": null.

vLLM validates every tool schema and rejects the whole request with a
400 ("None is not of type 'object'"), so one argument-less MCP tool
broke every call to such a server. Strict mode was not affected: it
already fills in an empty properties object.

Tool() now sends an empty object when the map is nil.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mudler
mudler merged commit b40513e into mudler:main Sep 28, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants