fix: accept omitted tool arguments for zero-param tools like get_me
Summary
- Treat nil or empty
argumentsontools/callas{}before JSON unmarshaling inNewServerToolWithContextHandler - Fixes
get_meand other zero-parameter tools when MCP clients omit theargumentsfield entirely instead of sending{}
Closes #2587
Problem
Some MCP clients omit the arguments field (or send an empty byte slice) when calling tools that declare no required parameters. The server previously attempted to unmarshal nil/empty input directly, producing invalid arguments: unexpected end of JSON input before the handler ran.
get_me is the most visible affected tool because its schema declares no required arguments, yet strict clients that omit arguments could not call it successfully.
Changes
pkg/inventory/server_tool.go: normalize emptyargumentsto{}before unmarshalingpkg/inventory/server_tool_test.go: cover nil, empty byte slice, and explicit{}inputspkg/github/context_tools_test.go: integration test forget_mewith omitted argumentspkg/github/helper_test.go: addcreateMCPRequestWithRawArgumentstest helper
Test plan
- [x]
go test ./pkg/inventory/... -run EmptyArguments - [x]
go test ./pkg/github/... -run 'GetMe|OmittedArguments'
Verified locally:
go test ./pkg/inventory/... -run EmptyArguments— passgo test ./pkg/github/... -run 'GetMe|OmittedArguments'— pass
Branch is up to date with main. Closed duplicate #2607 in favor of this PR.
Re-verified locally with Go 1.25:
go test ./pkg/inventory/... -run EmptyArguments— passgo test ./pkg/github/... -run 'GetMe|OmittedArguments'— pass
Branch is up to date with main. Ready for review.
Merge-ready check-in
This PR looks ready for maintainer review/merge when you have a moment.
- Change: fix: accept omitted tool arguments for zero-param tools like get_me
- CI: green / passing
- Review: REVIEW_REQUIRED (mergeable: MERGEABLE)
Happy to rebase or address any remaining feedback. Thanks for maintaining the project.