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>
This commit is contained in:
@@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.7.11] - 2025-07-10
|
||||
|
||||
### Enhanced
|
||||
- **Token Efficiency**: Significantly reduced MCP tool description lengths for better AI agent performance
|
||||
- Documentation tools: Average 129 chars (down from ~250-450)
|
||||
- Management tools: Average 93 chars (down from ~200-400)
|
||||
- Overall token reduction: ~65-70%
|
||||
- Moved detailed documentation to `tools_documentation()` system
|
||||
- Only 2 tools exceed 200 chars (list_nodes: 204, n8n_update_partial_workflow: 284)
|
||||
- Preserved all essential information while removing redundancy
|
||||
|
||||
### Fixed
|
||||
- **search_nodes Tool**: Major improvements to search functionality for AI agents
|
||||
- Primary nodes (webhook, httpRequest) now appear first in search results instead of being buried
|
||||
- Fixed issue where searching "webhook" returned specialized triggers instead of the main Webhook node
|
||||
- Fixed issue where searching "http call" didn't prioritize HTTP Request node
|
||||
- Fixed FUZZY mode returning no results for typos like "slak" (lowered threshold from 300 to 200)
|
||||
- Removed unnecessary searchInfo messages that appeared on every search
|
||||
- Fixed HTTP node type comparison case sensitivity issue
|
||||
- Implemented relevance-based ranking with special boosting for primary nodes
|
||||
|
||||
### Added
|
||||
- **FTS5 Full-Text Search**: Added SQLite FTS5 support for faster and more intelligent node searching
|
||||
- Automatic fallback to LIKE queries if FTS5 is unavailable
|
||||
- Supports advanced search modes: OR (default), AND (all terms required), FUZZY (typo-tolerant)
|
||||
- Significantly improves search performance for large databases
|
||||
- FUZZY mode now uses edit distance (Levenshtein) for better typo tolerance
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
@@ -516,6 +544,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Basic n8n and MCP integration
|
||||
- Core workflow automation features
|
||||
|
||||
[2.7.11]: https://github.com/czlonkowski/n8n-mcp/compare/v2.7.10...v2.7.11
|
||||
[2.7.10]: https://github.com/czlonkowski/n8n-mcp/compare/v2.7.8...v2.7.10
|
||||
[2.7.8]: https://github.com/czlonkowski/n8n-mcp/compare/v2.7.5...v2.7.8
|
||||
[2.7.5]: https://github.com/czlonkowski/n8n-mcp/compare/v2.7.4...v2.7.5
|
||||
|
||||
66
docs/token-efficiency-summary.md
Normal file
66
docs/token-efficiency-summary.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user