Skip to content

Conversation

yarin-tradezbird
Copy link

@yarin-tradezbird yarin-tradezbird commented Sep 6, 2025

Summary

Problem

Claude models were incorrectly marking all optional MCP tool parameters as required,
causing validation errors when Claude generated invalid default values in the args

Solution

Removed the faulty auto-requirement logic in format_tools_for_model() function in
agno/utils/models/claude.py that was making all non-nullable parameters required when no
explicit required parameters existed.

Changes

  • File: agno/utils/models/claude.py
  • Lines: 310-316
  • Type: Removed 7 lines of buggy logic

Testing

  • Verified Claude agents now work correctly with MCP tools
  • Tool calls no longer include invalid default parameters
  • Schema now respects original tool author's intent for optional vs required parameters

Type of change

  • [V] Bug fix
  • New feature
  • Breaking change
  • Improvement
  • Model update
  • Other:

Checklist

  • [V] Code complies with style guidelines
  • [V] Ran format/validation scripts (./scripts/format.sh and ./scripts/validate.sh)
  • Self-review completed
  • Documentation updated (comments, docstrings)
  • Examples and guides: Relevant cookbook examples have been included or updated (if applicable)
  • Tested in clean environment
  • Tests added/updated (if applicable)

Removed the faulty auto-requirement logic in `format_tools_for_model()` function in
  `agno/utils/models/claude.py` that was making all non-nullable parameters required when no
   explicit required parameters existed.
@yarin-tradezbird yarin-tradezbird requested a review from a team as a code owner September 6, 2025 08:51
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