WashedMCP: One Query, Token-Efficient Semantic Code Search with Tool Call Automation
How WashedMCP won NexHacks by solving AI coding assistant inefficiencies: token-optimized semantic search, call-graph context, and automated tool memory with LeanMCP hooks.
WashedMCP: One Query, Token-Efficient Semantic Code Search with Tool Call Automation
Answer First
How did WashedMCP win NexHacks at Carnegie Mellon? By solving two critical AI coding assistant problems: costly search loops and repetitive tool setup. WashedMCP delivers complete call-chain context in one query using semantic search + call-graph expansion, plus automated tool recommendations via LeanMCP hooks and tool-call memory.
Key innovations:
- One-shot semantic code search with caller/callee context
- TOON (Token-Optimized Object Notation) format reducing token overhead
- Automated tool installation based on usage pattern memory
- LeanMCP hook-based interception for seamless automation
Don't miss this: WashedMCP demonstrates how proper context optimization can reduce token usage by 70% while eliminating setup repetition across coding sessions.
Definition Box
Semantic Code Search: Search that understands code meaning and relationships, not just text matching.
Call-Graph Expansion: Including callers (functions that call this code) and callees (functions this code calls) for complete context.
TOON Format: Token-Optimized Object Notation - structured format that preserves hierarchy while reducing token overhead vs JSON.
Tool-Call Memory: System that remembers previous tool usage patterns to automate future recommendations and installations.
LeanMCP Hooks: Interception mechanism that allows observing and acting on tool calls without disrupting workflow.
Context Window: The amount of information an AI model can process in a single request, limited by token count.
The Problem: AI Coding Assistant Inefficiencies
With 240+ teams participating in NexHacks at Carnegie Mellon, WashedMCP stood out by tackling two of the most common failure modes in AI-assisted coding: costly search and setup repetition.
Developers using AI coding assistants on real repositories often hit two sources of inefficiency:
- Isolated snippets retrieved → multiple follow-ups to rebuild call-chain context
- Repeated tool installation/configuration → the same setup work re-run across sessions and projects
Each extra search and repeated setup call burns tokens, breaks momentum, and delays implementation.
What WashedMCP Adds: Context + Memory + Learning
1. One-Shot Semantic Code Search
WashedMCP combines meaning-based retrieval with depth-based code-graph expansion so one query can return the full context you actually need:
- Best matching function/class
- CALLS (callees)
- CALLED BY (callers)
- Same file neighbors that are likely relevant
- Configurable depth for multi-hop expansion
Why it matters: Semantic search reduces time spent manually searching for specific code patterns, streamlines onboarding onto unfamiliar codebases, and helps trace real debugging chains, allowing developers to focus on higher-value tasks.
2. Token-Optimized Output (TOON)
Results are formatted in TOON (Token Optimized Object Notation) to preserve structure while reducing overhead vs JSON.
Why it matters: As repositories grow, so does the amount of context needed to answer even basic questions, which quickly increases token usage and latency. TOON helps keep long-running, multi-turn coding sessions more stable and cost-effective while preserving the hierarchy and relationships that developers need.
3. Auto-Recommend + Auto-Install MCP Tools via Tool-Call Memory
WashedMCP's automated tool layer removes redundant setup loops by building a recommendation + auto-install pipeline that:
- Intercepts tool calls (via LeanMCP hooks)
- Records tool-call memory to detect repetition
- Recommends (and can auto-install) tools and steps based on observed patterns
Why it matters: This capability reduces setup work and prevents agents from spending time re-deriving workflows that have already been executed successfully. This results in a smoother developer experience and more efficient agent performance as teams adopt more MCP tools.
Where LeanMCP Made the Difference
WashedMCP's automation layer relies on LeanMCP's hook-based interception to observe tool usage patterns and apply memory-driven recommendations without being disruptive. In practice, tool memory turns static tool descriptions into dynamic, data-driven interactions; addressing the "description is not enough" problem where models must choose among many similar (and overlapping) tools.
Net effect:
- Higher tool-selection success rates
- Lower latency and costs via reduced redundancy
- Better scalability as tool ecosystems grow
- Continuous improvement as patterns are learned
Each implementation enhances the performance of AI coding assistants: (1) higher success rates due to optimized tool selection and usage; (2) improved efficiency and lower operational costs; (3) more reliably scaling by helping agents navigate large context windows without sacrificing quality; (4) continuous improvement as each tool call makes future recommendations and automation more accurate.
Technical Implementation
Semantic Search Architecture
// WashedMCP's semantic search with call-graph expansion
interface SearchResult {
matchedFunction: CodeFunction;
callers: CodeFunction[];
callees: CodeFunction[];
fileContext: CodeContext[];
relevanceScore: number;
}
class WashedMCPServer {
@Tool({
description: 'Semantic code search with call-graph context',
inputClass: SearchInput
})
async searchCode(input: SearchInput): Promise<SearchResult> {
const semanticMatch = await this.vectorSearch(input.query);
const callGraph = await this.buildCallGraph(semanticMatch);
return this.formatAsTOON({
match: semanticMatch,
context: callGraph,
depth: input.depth || 2
});
}
}
LeanMCP Hook Integration
// Tool-call memory and automation
import { Hook, ToolCallInterceptor } from '@leanmcp/hooks';
@Hook('tool-call')
class ToolMemoryHook implements ToolCallInterceptor {
async onToolCall(toolName: string, params: any) {
// Record usage pattern
await this.recordUsage(toolName, params);
// Check for automation opportunities
const recommendations = await this.getRecommendations(toolName);
if (recommendations.length > 0) {
return this.autoInstallTools(recommendations);
}
}
}
Performance Results
Token Efficiency:
- 70% reduction in token usage vs traditional snippet-based search
- Single query replaces 3-5 follow-up searches
- TOON format 40% more compact than JSON
Developer Experience:
- Setup automation reduces configuration time by 80%
- Context completeness improves debugging success rate
- Memory-driven recommendations increase tool adoption
Takeaways for Builders
- The biggest UX win is reducing loops, not adding knobs: return actionable context (not snippets) and eliminate repetitive setup
- Optimize token quality by returning structured, call-graph-aware context that reduces follow-up searches
- As tool ecosystems scale, memory + automation become table stakes for reliability and cost control
FAQ
Q: How does WashedMCP's semantic search differ from regular code search? A: Regular search returns isolated snippets. WashedMCP returns the matched code plus its callers, callees, and relevant file context in one query, eliminating follow-up searches.
Q: What is TOON format and why is it better than JSON? A: TOON (Token-Optimized Object Notation) preserves code structure while using 40% fewer tokens than JSON, making it more cost-effective for large context windows.
Q: How does the tool-call memory system work? A: LeanMCP hooks intercept tool calls, record usage patterns, and automatically recommend or install tools based on observed repetition, eliminating setup loops.
Q: Can WashedMCP work with any codebase? A: Yes, it uses Tree-sitter parsing which supports multiple programming languages and can analyze any repository structure.
Q: How does call-graph expansion improve debugging? A: By showing both callers and callees, developers can trace the full execution path and understand how code fits into the larger system without manual exploration.
Q: What makes LeanMCP hooks essential for this automation? A: LeanMCP hooks provide non-disruptive interception of tool calls, allowing WashedMCP to observe patterns and automate workflows without breaking existing functionality.
Q: How much token savings can developers expect? A: WashedMCP typically achieves 70% token reduction by eliminating follow-up searches and using TOON format instead of verbose JSON responses.
Q: Is the tool memory shared across different projects? A: Yes, the memory system learns patterns across sessions and projects, making tool recommendations more accurate over time.
Related Resources
- NexHacks Winners Overview - See all Carnegie Mellon hackathon winners
- LeanMCP SDK Guide - Learn how to build MCP applications like WashedMCP
- MCP Development Best Practices - Development tools and techniques
- Agent Runtime Performance - Optimize MCP application performance
Get Started with LeanMCP
Ready to build your own innovative MCP applications? WashedMCP shows what's possible with LeanMCP's infrastructure:
LeanMCP Platform: https://ship.leanmcp.com/
TypeScript SDK: https://github.com/LeanMCP/leanmcp-sdk
Documentation: https://docs.leanmcp.com/
WashedMCP demonstrates that the biggest wins come from reducing loops and optimizing context quality, not just adding features. Build smarter, not harder.
