Files
n8n-mcp/docs/token-efficiency-summary.md
czlonkowski d8e84307e4 feat: optimize MCP tool descriptions for 65-70% token reduction
- Reduced average description length from 250-450 to 93-129 chars
- Documentation tools now average 129 chars per description
- Management tools average just 93 chars per description
- Moved detailed documentation to tools_documentation() system
- Only 2 tools exceed 200 chars (necessarily verbose)

Also includes search_nodes improvements:
- Fixed primary node ranking (webhook, HTTP Request now appear first)
- Fixed FUZZY mode threshold for better typo tolerance
- Removed unnecessary searchInfo messages
- Fixed HTTP node type case sensitivity issue

This significantly improves AI agent performance by reducing context usage
while preserving all essential information.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-10 11:42:23 +02:00

66 lines
2.8 KiB
Markdown

# Token Efficiency Improvements Summary
## Overview
Made all MCP tool descriptions concise and token-efficient while preserving essential information.
## Key Improvements
### Before vs After Examples
1. **search_nodes**
- Before: ~350 chars with verbose explanation
- After: 165 chars
- `Search nodes by keywords. Modes: OR (any word), AND (all words), FUZZY (typos OK). Primary nodes ranked first. Examples: "webhook"→Webhook, "http call"→HTTP Request.`
2. **get_node_info**
- Before: ~450 chars with warnings about size
- After: 174 chars
- `Get FULL node schema (100KB+). TIP: Use get_node_essentials first! Returns all properties/operations/credentials. Prefix required: "nodes-base.httpRequest" not "httpRequest".`
3. **validate_node_minimal**
- Before: ~350 chars explaining what it doesn't do
- After: 102 chars
- `Fast check for missing required fields only. No warnings/suggestions. Returns: list of missing fields.`
4. **get_property_dependencies**
- Before: ~400 chars with full example
- After: 131 chars
- `Shows property dependencies and visibility rules. Example: sendBody=true reveals body fields. Test visibility with optional config.`
## Statistics
### Documentation Tools (22 tools)
- Average description length: **129 characters**
- Total characters: 2,836
- Tools over 200 chars: 1 (list_nodes at 204)
### Management Tools (17 tools)
- Average description length: **93 characters**
- Total characters: 1,578
- Tools over 200 chars: 1 (n8n_update_partial_workflow at 284)
## Strategy Used
1. **Remove redundancy**: Eliminated repeated information available in parameter descriptions
2. **Use abbreviations**: "vs" instead of "versus", "&" instead of "and" where appropriate
3. **Compact examples**: `"webhook"→Webhook` instead of verbose explanations
4. **Direct language**: "Fast check" instead of "Quick validation that only checks"
5. **Move details to documentation**: Complex tools reference `tools_documentation()` for full details
6. **Essential info only**: Focus on what the tool does, not how it works internally
## Special Cases
### n8n_update_partial_workflow
This tool's description is necessarily longer (284 chars) because:
- Lists all 13 operation types
- Critical for users to know available operations
- Directs to full documentation for details
### Complex Documentation Preserved
For tools like `n8n_update_partial_workflow`, detailed documentation was moved to `tools-documentation.ts` rather than deleted, ensuring users can still access comprehensive information when needed.
## Impact
- **Token savings**: ~65-70% reduction in description tokens
- **Faster AI responses**: Less context used for tool descriptions
- **Better UX**: Clearer, more scannable tool list
- **Maintained functionality**: All essential information preserved