Skip to content

Fix omitted tool arguments - #3099

Merged
SamMorrowDrums merged 1 commit into
mainfrom
sammorrowdrums-optional-tool-arguments
Aug 19, 2026
Merged

Fix omitted tool arguments#3099
SamMorrowDrums merged 1 commit into
mainfrom
sammorrowdrums-optional-tool-arguments

Conversation

@SamMorrowDrums

Copy link
Copy Markdown
Collaborator

Summary

  • treat omitted, nil, and zero-length tools/call arguments as an empty JSON object
  • keep explicit null and malformed JSON invalid while allowing parameterized tools to run their existing required-field validation
  • add table-driven wrapper coverage and a get_me handler regression test

Rationale

The MCP 2026-07-28 schema makes CallToolRequestParams.arguments optional, but constrains it to an object when present. The shared wrapper now supplies {} only when the raw argument bytes are absent. It deliberately does not handle a missing params object, leaving the go-sdk protocol boundary to reject that required field.

Validation

  • script/lint
  • script/test

Fixes #2587

This independently authored change supersedes duplicate attempts #2632, #2680, and #2689. No commits were copied or cherry-picked from those branches; this branch starts at origin/main commit 8395beae410e4fe50c4610e2b354a40d21997f45.

@SamMorrowDrums
SamMorrowDrums requested a review from a team as a code owner August 19, 2026 09:46
Copilot AI balanced review requested due to automatic review settings August 19, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes omitted tool arguments by normalizing absent payloads to {} while preserving validation failures.

Changes:

  • Normalizes nil and zero-length arguments.
  • Rejects explicit null and malformed JSON.
  • Adds wrapper and get_me regression coverage.
Show a summary per file
File Description
pkg/inventory/server_tool.go Normalizes omitted arguments and centralizes errors.
pkg/inventory/server_tool_test.go Adds table-driven argument handling tests.
pkg/github/context_tools_test.go Verifies get_me accepts omitted arguments.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Normalize missing or zero-length tool arguments to an empty object while preserving invalid JSON and required-parameter validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SamMorrowDrums
SamMorrowDrums force-pushed the sammorrowdrums-optional-tool-arguments branch from 1b72832 to 9df1e3b Compare August 19, 2026 10:20
@SamMorrowDrums
SamMorrowDrums merged commit 4665185 into main Aug 19, 2026
19 checks passed
@SamMorrowDrums
SamMorrowDrums deleted the sammorrowdrums-optional-tool-arguments branch August 19, 2026 10:24
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.

bug: get_me tool fails without parameters due to empty JSON object {} not being accepted as valid input

2 participants