-
Notifications
You must be signed in to change notification settings - Fork 36
feat: Add extract_code tool to Agent MCP server #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add extract_code tool to the probe-agent MCP server to complement the existing search_code tool. This allows AI assistants to retrieve complete code blocks based on file paths and symbols returned by search_code. The tool uses the same underlying extract function as the low-level MCP server, with identical options (XML format, test files included). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Overview: Add extract_code Tool to Agent MCP ServerSummaryThis PR adds the Files Changednpm/src/agent/index.js (+58 lines, -2 lines)
Architecture & Impact AssessmentWhat This PR Accomplishes
Key Technical Changes
Affected System Componentsgraph TD
A[AI Assistant] -->|MCP Call| B[Probe Agent MCP Server]
B -->|search_code| C[ProbeAgent.answer]
B -->|extract_code| D[extract function]
D -->|AST Parsing| E[probe binary]
E -->|Code Blocks| D
D -->|XML Format| B
B -->|Text Response| A
style D fill:#90EE90
style B fill:#87CEEB
Component Flow:
Integration Points
Scope Discovery & Context ExpansionDirect Impact
Related Files (Context)Based on code analysis, these files are related but unchanged:
Potential Follow-up Areas
Technical DetailsTool Schema{
name: 'extract_code',
description: 'Extract full code blocks from files using tree-sitter AST parsing...',
inputSchema: {
type: 'object',
properties: {
path: { type: 'string', description: 'Absolute path to project root' },
files: {
type: 'array',
items: { type: 'string' },
description: 'File paths with optional line numbers or symbols'
}
},
required: ['path', 'files']
}
}Default Options
Error Handling
Review NotesComplexity: Low
Testing Recommendations
Code Quality
Metadata
Powered by Visor from Probelabs Last updated: 2026-01-18T20:22:55.785Z | Triggered by: pr_opened | Commit: 74c2df7 💡 TIP: You can chat with Visor using |
Security Issues (4)
Architecture Issues (5)
✅ Performance Check PassedNo performance issues found – changes LGTM. Quality Issues (5)
Powered by Visor from Probelabs Last updated: 2026-01-18T20:22:58.454Z | Triggered by: pr_opened | Commit: 74c2df7 💡 TIP: You can chat with Visor using |
Summary
extract_codetool to the probe-agent MCP server (probe agent --mcp)search_codetool by allowing AI assistants to retrieve complete code blocksextractfunction as the low-level MCP server with identical options (XML format, test files included)Changes
extractfunction from main packageextract_codetool definition with schema forpathandfilesparametersTest plan
probe agent --mcpstarts successfullyextract_codetool with valid file pathsextract_codetool with symbol extraction (e.g.,file.js#funcName)extract_codetool with line ranges (e.g.,file.js:10-20)🤖 Generated with Claude Code