MCP Token-Efficient Tools

Guide for MCP Token-Efficient Tools

MCP Token-Efficient Tools

12 tools designed to reduce token usage by returning concise, actionable data.

KB Efficiency Tools (5)

ToolPurposeToken Savings
kb_headlinesList paths+titles only~95%
kb_sectionExtract specific heading~70-90%
summarize_kb_filePreview + heading outline~85%
batch_search_kbMultiple queries in 1 callRound-trips
kb_file_statsWord count, headings, links~98%

Code Analysis Tools (7)

ToolPurposeToken Savings
rust_module_outlineStruct/fn signatures only~80%
rust_crate_structureModule tree + pub exports~90%
rust_impl_summaryList impls for a type~85%
find_type_usagesWhere is Type X used?Targeted
get_function_signatureSingle fn signature only~95%
list_cargo_depsCrate deps + features~90%
find_trait_implsWhat impls Trait X?Targeted

Tool Specifications

kb_headlines

{ "directory?": "mechanics", "tag?": "combat", "limit": 50 }
// Returns: { count, files: [{ path, title }] }

kb_section

{ "file_path": "mechanics/combat.md", "heading": "Damage" }
// Returns: Extracted section content

summarize_kb_file

{ "file_path": "mechanics/combat.md", "preview_chars": 500 }
// Returns: { title, path, preview, headings[], total_chars }

batch_search_kb

{ "queries": ["combat", "skills"], "limit_per_query": 3 }
// Returns: { "combat": [results], "skills": [results] }

kb_file_stats

{ "file_path": "mechanics/combat.md" }
// Returns: { words, headings, links, code_blocks, tags, frontmatter_keys }

rust_module_outline

{ "file_path": "/path/to/file.rs", "include_private": false }
// Returns: pub structs, enums, fns with signatures (no bodies)

rust_crate_structure

{ "crate_path": "/path/to/crate" }
// Returns: { crate, entry, modules[] }

rust_impl_summary

{ "type_name": "Player", "scope": "/path/to/src" }
// Returns: All impl blocks for type (grep output)

find_type_usages

{ "type_name": "Player", "scope": "/path/to/src", "limit": 30 }
// Returns: { type, usages, locations: ["file:line"] }

get_function_signature

{ "function_name": "calculate_damage", "file_path": "/path/to/file.rs" }
// Returns: Just the fn signature, no body

list_cargo_deps

{ "crate_path": "/path/to/crate" }
// Returns: [dependencies] section from Cargo.toml

find_trait_impls

{ "trait_name": "Display", "scope": "/path/to/src" }
// Returns: { trait, implementations: [{ location, impl }] }

Bonus: Agent Context Tool

get_agent_rules

{ "include_coding_standards": false, "include_workflows": true }
// Returns: { agent_instructions[], rust_standards?, nodejs_standards?, available_workflows[] }

Usage Pattern

Before (high token usage):
read_kb_file → full 5000 char file
read_kb_file → full 3000 char file
grep for type → full lines
After (optimized):
batch_search_kb → compact results
kb_section → only needed section
find_type_usages → file:line pairs only

Implementation