Skip to content

Clarify missing tool_result validation error#3053

Open
HarperZ9 wants to merge 1 commit into
modelcontextprotocol:mainfrom
HarperZ9:codex/tool-result-missing-diagnostic
Open

Clarify missing tool_result validation error#3053
HarperZ9 wants to merge 1 commit into
modelcontextprotocol:mainfrom
HarperZ9:codex/tool-result-missing-diagnostic

Conversation

@HarperZ9

@HarperZ9 HarperZ9 commented Jul 2, 2026

Copy link
Copy Markdown

Summary

  • keep tool_use / tool_result balance validation strict
  • split the missing-follow-up case into a clearer ValueError
  • add a direct regression test for an assistant tool_use followed by user text instead of tool_result

Related to #2960. This PR does not relax the balance rule; it only makes the diagnostic distinguish a missing tool_result from an ID mismatch when a tool_use is followed by a non-result message.

Tests

  • uv run --frozen pytest tests/server/test_validation.py -q
  • uv run --frozen ruff check src/mcp/server/validation.py tests/server/test_validation.py
  • uv run --frozen ruff format --check src/mcp/server/validation.py tests/server/test_validation.py
  • git diff --check

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more

Re-trigger cubic

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.

1 participant