Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 4, 2026

Problem

The Grep tool handler uses a parameter named max_results internally, but the tool definition exposed to models uses head_limit as the parameter name. This inconsistency can cause models to send incorrect parameter names, resulting in the limit not being applied correctly.

Solution

Added a serde alias #[serde(alias = "head_limit")] to the max_results field in the GrepArgs struct. This allows the handler to accept both parameter names:

  • max_results (internal name)
  • head_limit (tool definition name)

Testing

  • Verified the code compiles with cargo check -p cortex-engine
  • The serde alias is a well-established pattern for handling parameter name variations

echobt added a commit that referenced this pull request Feb 4, 2026
This PR consolidates the following tools fixes:
- #53: Add serde alias for Glob tool folder parameter
- #62: Align tool handler names with registration names
- #63: Add serde alias for Grep tool head_limit parameter

Key changes:
- Added serde aliases for backward compatibility
- Fixed mismatched handler names to match tool registration
- Improved tool parameter handling consistency
@echobt
Copy link
Contributor Author

echobt commented Feb 4, 2026

Consolidated into #75 - fix(tools): consolidated tools parameter aliases and handler name fixes

@echobt echobt closed this Feb 4, 2026
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