MCP Usage & Examples
Practical guides, examples, and best practices for using MCP tools
📖 MCP Usage & Examples
Status: ✅ Complete (Session 42.2)
Practical guides, code examples, and best practices for using all 37 MCP tools effectively.
📚 Complete Tool Reference
Core Tools (Everyday Use)
mcp_init
🚀 Smart startup dashboard with mode selection
// Initialize MCP session
mcp_init({ task: "implement user authentication" })
// Pre-select mode
mcp_init({ mode: "quick", skipPrompt: true })
Modes:
quick- Fast context retrieval (~100 tokens)orchestrated- Full decision capture with learningsearch- Semantic search focusstats- System analytics
preflight
🧠 Get intelligent context (~100 tokens) before any task
// Basic usage
preflight({ task: "add dark mode toggle" })
// Enforce specific session
preflight({ task: "continue auth work", sessionNumber: 42 })
// Ultra-minimal mode
preflight({ task: "quick fix", lite: true })
Best Practice: Call this BEFORE starting any implementation task.
log_decision
📝 Record development decisions for ML learning
log_decision({
type: "architecture", // or "implementation", "refactor", "bugfix", "pattern", "convention"
question: "How should we handle user authentication?",
chosen: "JWT tokens with refresh mechanism",
reasoning: "Better for mobile apps and stateless architecture",
confidence: 0.85,
options: ["Session cookies", "JWT tokens", "OAuth only"],
files: ["src/auth/auth.service.ts", "src/auth/jwt.strategy.ts"]
})
Decision Types:
architecture- High-level design decisionsimplementation- Coding approach choicesrefactor- Code improvement decisionsbugfix- Bug resolution choicespattern- Design pattern selectionsconvention- Code style/standard decisions
find_similar
🔍 Semantic search for past decisions
// Find similar decisions
find_similar({ query: "authentication patterns", limit: 5 })
// Filter by type
find_similar({ query: "CDK drag drop", type: "implementation" })
report_outcome
📊 Report success/failure for reinforcement learning
report_outcome({
decisionId: "dec_abc123",
wasSuccessful: true,
rating: 5, // 1-5
feedback: "Clean implementation, no issues in production"
})
Note: Enhanced in Session 42.2 with 4-strategy auto-detection (NX cache, dist folder, test results, terminal logs).
get_conventions / add_convention
📋 Manage learned codebase conventions
// Get conventions
get_conventions({ category: "angular" })
// Add new convention
add_convention({
category: "components",
rule: "Always use OnPush change detection",
examples: ["changeDetection: ChangeDetectionStrategy.OnPush"],
source: "performance-optimization"
})
get_stats
📈 System statistics and agent performance
get_stats()
// Returns: decision counts, success rates, agent activity, memory usage
get_session_info / set_session
📍 Session tracking and management
// Get current session
get_session_info()
// Enforce specific session (v8.2)
set_session({ sessionNumber: 42, subSessionNumber: 42.2 })
Knowledge Graph Tools (Session 42)
The knowledge graph tracks relationships between files, modules, patterns, and decisions.
graph_create_entity
📍 Create entities in the knowledge graph
graph_create_entity({
name: "auth.service.ts",
type: "file", // file, module, pattern, decision, library, agent, convention
properties: {
path: "src/auth/auth.service.ts",
purpose: "Authentication service"
}
})
graph_create_relation
🔗 Create relationships between entities
graph_create_relation({
from: "auth.service.ts",
to: "jwt.strategy.ts",
type: "DEPENDS_ON", // USES, DEPENDS_ON, AFFECTS, CREATED_BY, PART_OF, RELATED_TO, IMPLEMENTS, BREAKS
weight: 0.9
})
graph_query
🕸️ Natural language graph queries
// Query by natural language
graph_query({ query: "what affects sidebar-nav" })
// Query by entity
graph_query({ entityId: "file:auth.service.ts", direction: "incoming" })
// Filter by type
graph_query({ entityType: "module", relationType: "DEPENDS_ON" })
graph_find_impact
💥 Impact analysis for file/module changes
// What will be affected if I change this file?
graph_find_impact({ fileName: "auth.service.ts" })
// Module impact
graph_find_impact({ moduleName: "authentication" })
graph_build_from_decisions / graph_stats
🏗️ Build and monitor the knowledge graph
// Auto-build graph from existing decisions
graph_build_from_decisions()
// Get graph statistics
graph_stats()
Web & Documentation Search (Session 42)
web_search
🌐 Search the web via Tavily API
web_search({
query: "Angular 20 standalone components best practices",
searchType: "documentation", // general, news, documentation
maxResults: 5,
recency: "month", // day, week, month, year
saveToMemory: true
})
docs_search
📚 Search library documentation
docs_search({
query: "drag and drop sortable list",
libraries: ["@angular/cdk", "rxjs"],
version: "20.0.0",
maxResults: 5
})
Code Generation Tools (Session 42.2)
space_generate (NEW)
🎨 QuickGenerate-style code generation for space builders
Inspired by gograb-modules QuickGenerate patterns.
// Quick widget generation
space_generate({
action: "quick",
type: "button",
name: "SubmitButton",
variant: "primary"
})
// Full widget with all options
space_generate({
action: "widget",
type: "table",
name: "ProductTable",
features: ["sorting", "filtering", "pagination"]
})
// Generate entire module
space_generate({
action: "module",
name: "user-management",
entities: ["User", "Role", "Permission"],
features: ["crud", "filters", "export"]
})
// Preview before generating
space_generate({
action: "preview",
type: "form",
name: "LoginForm"
})
// List all available widget types
space_generate({ action: "list_types" })
Supported Widget Types:
button- Action buttons with variantstable- Data tables with sorting, filtering, paginationform- Forms with validationcard- Card componentsmodal- Modal dialogsdashboard- Dashboard layoutslist- List viewsdetail- Detail/view pagesfilters- Filter componentschart- Chart componentssidebar- Sidebar navigationnavbar- Navigation barstabs- Tab componentsaccordion- Accordion/collapsible panelsstepper- Step wizards
analyze_requirement
📋 Analyze user requirements for modules
analyze_requirement({
description: "Create a product catalog with search and filters",
features: ["search", "filters", "pagination", "export"],
context: { existingModules: ["auth", "users"] }
})
validate_module
✅ Validate module against editor2 standards
validate_module({
modulePath: "modules/business/product-catalog",
strictMode: true
})
// Returns: validation results with auto-fixable issues
Workflow & Session Recovery (Session 42.2)
workflow (NEW)
🔄 Session recovery and task continuity
Addresses "session continuity broken" gap for cross-agent handoff.
// What was I working on? (cross-agent handoff)
workflow({ action: "recover_session" })
// Quick codebase orientation for new sessions
workflow({ action: "discover_project" })
// Retrieve multi-step task progress
workflow({ action: "get_task_state", taskId: "task_abc123" })
// Save task progress for later recovery
workflow({
action: "save_task_state",
description: "Implement authentication flow",
steps: [
{ name: "Create auth service", status: "completed" },
{ name: "Add JWT strategy", status: "in_progress" },
{ name: "Write tests", status: "pending" }
]
})
Advanced ML Tools
predict_outcome
🔮 ML-based outcome prediction before making decisions
predict_outcome({
decision: {
type: "implementation",
question: "Use signals or observables for state?",
chosen: "Signals for local state",
reasoning: "Simpler API, better performance",
confidence: 0.8
}
})
// Returns: predicted success probability based on historical data
mine_patterns
⛏️ Extract patterns from successful decisions
mine_patterns({
minSuccessRate: 0.7,
minSupport: 3,
patternTypes: ["sequential", "contextual", "outcome"],
limit: 20
})
transfer_intelligence
🔄 Cross-tier learning transfer
// Transfer learnings from development to platform tier
transfer_intelligence({
sourceTier: "development",
targetTier: "platform"
})
Diagnostics & Analytics
get_enhanced_stats
📊 Comprehensive system statistics
get_enhanced_stats()
// Returns: context analysis, git integration, outcome tracking,
// anti-pattern detection, decision capture stats
get_session_summary
📝 Session summary with git activity
get_session_summary({ sessionID: "editor2-42.2" })
// Returns: git commits, file changes, decisions, anti-pattern warnings
get_lifecycle_status
📈 Decision lifecycle tracking
get_lifecycle_status({ includeCompleted: false })
// Specific decision
get_lifecycle_status({ decisionId: "dec_abc123" })
get_pending_outcomes
⏳ Decisions awaiting feedback
get_pending_outcomes()
// Returns: decisions that need outcome reporting
run_outcome_validation
🔍 Manual outcome validation check
run_outcome_validation()
// Checks for errors, reverts, and stability across all pending decisions
learn_from_outcomes
🧠 Update anti-pattern detection from validated outcomes
learn_from_outcomes()
// Analyzes failed decisions to improve future warnings
init_git_tracking
🔀 Initialize git tracking for current session
init_git_tracking()
// Starts tracking commits, file changes, and line statistics
get_platform_info
🖥️ Platform detection and analytics
get_platform_info({ includeHistory: true })
// Returns: detected platform (cursor, claude-code, etc.),
// environment info, cross-platform learning status
get_ai_generation_rules
📚 AI generation documentation and rules
// Get rules document
get_ai_generation_rules({ document: "rules" })
// Get quick reference
get_ai_generation_rules({ document: "quick-reference", summaryOnly: true })
// Get specific section
get_ai_generation_rules({ document: "rules", section: "Anti-Patterns" })
🔄 Common Workflows
Starting a New Task
// 1. Initialize session
mcp_init({ task: "implement feature X" })
// 2. Get context
preflight({ task: "implement feature X" })
// 3. Check for similar past work
find_similar({ query: "feature X patterns" })
// 4. Check impact
graph_find_impact({ moduleName: "affected-module" })
After Implementation
// 1. Log the decision
log_decision({
type: "implementation",
question: "How to implement feature X?",
chosen: "Used pattern Y",
reasoning: "Better performance and maintainability",
confidence: 0.85
})
// 2. Report outcome after testing
report_outcome({
decisionId: "dec_abc123",
wasSuccessful: true,
rating: 4
})
Session Handoff (Multi-Agent)
// When switching agents or resuming work
workflow({ action: "recover_session" })
// For new session orientation
workflow({ action: "discover_project" })
Code Generation for Space Builders
// Generate a complete form
space_generate({
action: "widget",
type: "form",
name: "ContactForm",
features: ["validation", "submit"]
})
// Generate a data table
space_generate({
action: "widget",
type: "table",
name: "OrdersTable",
features: ["sorting", "filtering", "pagination", "export"]
})
📅 Version History
| Version | Session | Changes |
|---|---|---|
| 5.2.0 | 42.2 | Added space_generate, workflow tools |
| 5.1.0 | 42 | Tool consolidation (64→37), knowledge graph, web search |
| 5.0.0 | 30 | Three-tier pipeline, multi-platform support |
Last Updated: January 14, 2026 (Session 42.2) Total Tools: 37 MCP tools documented