You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: enhance tool detection to support all MCP registration patterns
Significantly expand tool detection capabilities to find tools registered
using various patterns beyond the original @mcp.tool(name='...') decorator.
## What Changed:
**Enhanced Tool Detection (6 patterns supported):**
1. @mcp.tool(name='tool_name') - explicit name with decorator
2. @mcp.tool() - uses function name as tool name
3. app.tool('tool_name')(function) - programmatic registration
4. mcp.tool()(function) - programmatic with function name
5. self.mcp.tool(name='tool_name')(function) - instance method registration
6. @<var>.tool(name='tool_name') - generic variable decorator
**Simplified Validation Logic:**
- Consolidated fully qualified name validation into validate_tool_name()
- Removed duplicate length checking code
- Cleaner separation of concerns between tool detection and validation
**Improved Output:**
- Shows tool name length instead of fully qualified name in verbose mode
- Clearer, more concise output format
- Better focus on actionable information
## Why These Changes:
The original implementation only detected Pattern 1 (@mcp.tool with explicit name),
which meant many tools in the codebase were not being validated. This enhancement
ensures comprehensive coverage across all MCP tool registration methods used in
awslabs MCP servers.
## Testing:
Verified across multiple servers with different naming conventions:
- snake_case: git-repo-research-mcp-server (5 tools found)
- kebab-case: elasticache-mcp-server (38 tools found, all detected)
- PascalCase: amazon-kendra-index-mcp-server (2 tools found)
All tools now correctly detected and validated.
Related to awslabs#616
0 commit comments