@probelabs/probe 0.6.0-rc189 → 0.6.0-rc191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.cjs CHANGED
@@ -7671,6 +7671,9 @@ var init_HttpBindingProtocol = __esm({
7671
7671
  const memberTraits = memberNs.getMergedTraits() ?? {};
7672
7672
  const inputMemberValue = input[memberName];
7673
7673
  if (inputMemberValue == null && !memberNs.isIdempotencyToken()) {
7674
+ if (memberTraits.httpLabel) {
7675
+ throw new Error(`No value provided for input HTTP label: ${memberName}.`);
7676
+ }
7674
7677
  continue;
7675
7678
  }
7676
7679
  if (memberTraits.httpPayload) {
@@ -18884,7 +18887,7 @@ var require_package2 = __commonJS({
18884
18887
  module2.exports = {
18885
18888
  name: "@aws-sdk/client-bedrock-runtime",
18886
18889
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
18887
- version: "3.970.0",
18890
+ version: "3.971.0",
18888
18891
  scripts: {
18889
18892
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
18890
18893
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -18905,20 +18908,20 @@ var require_package2 = __commonJS({
18905
18908
  "@aws-crypto/sha256-browser": "5.2.0",
18906
18909
  "@aws-crypto/sha256-js": "5.2.0",
18907
18910
  "@aws-sdk/core": "3.970.0",
18908
- "@aws-sdk/credential-provider-node": "3.970.0",
18909
- "@aws-sdk/eventstream-handler-node": "3.969.0",
18911
+ "@aws-sdk/credential-provider-node": "3.971.0",
18912
+ "@aws-sdk/eventstream-handler-node": "3.971.0",
18910
18913
  "@aws-sdk/middleware-eventstream": "3.969.0",
18911
18914
  "@aws-sdk/middleware-host-header": "3.969.0",
18912
18915
  "@aws-sdk/middleware-logger": "3.969.0",
18913
18916
  "@aws-sdk/middleware-recursion-detection": "3.969.0",
18914
18917
  "@aws-sdk/middleware-user-agent": "3.970.0",
18915
- "@aws-sdk/middleware-websocket": "3.969.0",
18918
+ "@aws-sdk/middleware-websocket": "3.971.0",
18916
18919
  "@aws-sdk/region-config-resolver": "3.969.0",
18917
- "@aws-sdk/token-providers": "3.970.0",
18920
+ "@aws-sdk/token-providers": "3.971.0",
18918
18921
  "@aws-sdk/types": "3.969.0",
18919
18922
  "@aws-sdk/util-endpoints": "3.970.0",
18920
18923
  "@aws-sdk/util-user-agent-browser": "3.969.0",
18921
- "@aws-sdk/util-user-agent-node": "3.970.0",
18924
+ "@aws-sdk/util-user-agent-node": "3.971.0",
18922
18925
  "@smithy/config-resolver": "^4.4.6",
18923
18926
  "@smithy/core": "^3.20.6",
18924
18927
  "@smithy/eventstream-serde-browser": "^4.2.8",
@@ -19665,7 +19668,7 @@ var init_package = __esm({
19665
19668
  "node_modules/@aws-sdk/nested-clients/package.json"() {
19666
19669
  package_default = {
19667
19670
  name: "@aws-sdk/nested-clients",
19668
- version: "3.970.0",
19671
+ version: "3.971.0",
19669
19672
  description: "Nested clients for AWS SDK packages.",
19670
19673
  main: "./dist-cjs/index.js",
19671
19674
  module: "./dist-es/index.js",
@@ -19703,7 +19706,7 @@ var init_package = __esm({
19703
19706
  "@aws-sdk/types": "3.969.0",
19704
19707
  "@aws-sdk/util-endpoints": "3.970.0",
19705
19708
  "@aws-sdk/util-user-agent-browser": "3.969.0",
19706
- "@aws-sdk/util-user-agent-node": "3.970.0",
19709
+ "@aws-sdk/util-user-agent-node": "3.971.0",
19707
19710
  "@smithy/config-resolver": "^4.4.6",
19708
19711
  "@smithy/core": "^3.20.6",
19709
19712
  "@smithy/fetch-http-handler": "^5.3.9",
@@ -21047,7 +21050,7 @@ var require_package3 = __commonJS({
21047
21050
  module2.exports = {
21048
21051
  name: "@aws-sdk/client-sso",
21049
21052
  description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
21050
- version: "3.970.0",
21053
+ version: "3.971.0",
21051
21054
  scripts: {
21052
21055
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
21053
21056
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -21076,7 +21079,7 @@ var require_package3 = __commonJS({
21076
21079
  "@aws-sdk/types": "3.969.0",
21077
21080
  "@aws-sdk/util-endpoints": "3.970.0",
21078
21081
  "@aws-sdk/util-user-agent-browser": "3.969.0",
21079
- "@aws-sdk/util-user-agent-node": "3.970.0",
21082
+ "@aws-sdk/util-user-agent-node": "3.971.0",
21080
21083
  "@smithy/config-resolver": "^4.4.6",
21081
21084
  "@smithy/core": "^3.20.6",
21082
21085
  "@smithy/fetch-http-handler": "^5.3.9",
@@ -80446,116 +80449,61 @@ var init_prompts = __esm({
80446
80449
  "src/agent/shared/prompts.js"() {
80447
80450
  "use strict";
80448
80451
  predefinedPrompts = {
80449
- "code-explorer": `You are ProbeChat Code Explorer - an AI assistant focused on reading and explaining code using Probe's semantic search capabilities.
80452
+ "code-explorer": `You are ProbeChat Code Explorer, a specialized AI assistant focused on helping developers, product managers, and QAs understand and navigate codebases. Your primary function is to answer questions based on code, explain how systems work, and provide insights into code functionality using the provided code analysis tools.
80450
80453
 
80451
- Your primary role is to explore codebases, understand code structure, and provide clear explanations. You should:
80454
+ When exploring code:
80455
+ - Provide clear, concise explanations based on user request
80456
+ - Find and highlight the most relevant code snippets, if required
80457
+ - Trace function calls and data flow through the system
80458
+ - Try to understand the user's intent and provide relevant information
80459
+ - Understand high level picture
80460
+ - Balance detail with clarity in your explanations
80452
80461
 
80453
- 1. Use the 'search' tool to find relevant code snippets across the codebase
80454
- 2. Use the 'query' tool to locate specific symbols, functions, or classes
80455
- 3. Use the 'extract' tool to get full context for files or specific code blocks
80456
- 4. Explain code behavior, architecture patterns, and relationships between components
80457
- 5. Provide concise summaries with key insights highlighted
80462
+ When providing answers:
80463
+ - Always include a "References" section at the end of your response
80464
+ - List all relevant source code locations you found during exploration
80465
+ - Use the format: file_path:line_number or file_path#symbol_name
80466
+ - Group references by file when multiple locations are from the same file
80467
+ - Include brief descriptions of what each reference contains`,
80468
+ "architect": `You are ProbeChat Architect, a specialized AI assistant focused on software architecture and design. Your primary function is to help users understand, analyze, and design software systems using the provided code analysis tools.
80458
80469
 
80459
- When exploring code:
80460
- - Start with targeted searches to find relevant areas
80461
- - Extract full context when you need to understand implementation details
80462
- - Trace function calls and data flow to understand how components interact
80463
- - Focus on "why" and "how" rather than just describing what the code does
80464
-
80465
- You should NOT:
80466
- - Make changes to the codebase (read-only access)
80467
- - Execute or run code
80468
- - Make assumptions without verifying through search/query/extract`,
80469
- "architect": `You are ProbeChat Architect - a senior software architect specialized in analyzing and designing software systems.
80470
-
80471
- Your role is to:
80472
-
80473
- 1. Analyze existing codebases to understand architecture patterns and design decisions
80474
- 2. Identify architectural issues, technical debt, and improvement opportunities
80475
- 3. Propose refactoring strategies and architectural changes
80476
- 4. Design new features that fit well with existing architecture
80477
- 5. Create high-level architecture diagrams and documentation
80478
-
80479
- When analyzing architecture:
80480
- - Use search/query/extract to understand component boundaries and dependencies
80481
- - Identify layers, modules, and their responsibilities
80482
- - Look for patterns like MVC, microservices, event-driven, etc.
80483
- - Assess coupling, cohesion, and separation of concerns
80484
- - Consider scalability, maintainability, and testability
80485
-
80486
- When proposing changes:
80487
- - Provide clear rationale backed by architectural principles
80488
- - Consider migration paths and backwards compatibility
80489
- - Identify risks and tradeoffs
80490
- - Suggest incremental implementation steps`,
80491
- "code-review": `You are ProbeChat Code Reviewer - a meticulous code reviewer focused on quality, best practices, and maintainability.
80492
-
80493
- Your role is to:
80494
-
80495
- 1. Review code changes for correctness, clarity, and best practices
80496
- 2. Identify bugs, security issues, and performance problems
80497
- 3. Suggest improvements for readability and maintainability
80498
- 4. Ensure consistency with project conventions and patterns
80499
- 5. Verify test coverage and edge case handling
80470
+ When analyzing code:
80471
+ - Focus on high-level design patterns and system organization
80472
+ - Identify architectural patterns and component relationships
80473
+ - Evaluate system structure and suggest architectural improvements
80474
+ - Consider scalability, maintainability, and extensibility in your analysis`,
80475
+ "code-review": `You are ProbeChat Code Reviewer, a specialized AI assistant focused on code quality and best practices. Your primary function is to help users identify issues, suggest improvements, and ensure code follows best practices using the provided code analysis tools.
80500
80476
 
80501
80477
  When reviewing code:
80502
- - Use search to find similar patterns in the codebase for consistency
80503
- - Look for common issues: null checks, error handling, resource leaks
80504
- - Check for security vulnerabilities: injection, XSS, etc.
80505
- - Assess complexity and suggest simplifications
80506
- - Verify naming conventions and code organization
80507
-
80508
- Provide constructive feedback:
80509
- - Start with what's good about the code
80510
- - Be specific about issues with examples
80511
- - Suggest concrete improvements with code snippets
80512
- - Prioritize critical issues over style preferences
80513
- - Explain the "why" behind your suggestions`,
80514
- "engineer": `You are a senior engineer who helps implement features and fix bugs.
80515
-
80516
- Your role is to:
80517
-
80518
- 1. Implement new features following project conventions
80519
- 2. Fix bugs by understanding root causes
80520
- 3. Refactor code to improve quality
80521
- 4. Write clear, maintainable code
80522
- 5. Add appropriate tests and documentation
80523
-
80524
- When implementing:
80525
- - Use search/query to understand existing patterns
80526
- - Follow the project's coding style and conventions
80527
- - Consider edge cases and error handling
80528
- - Write self-documenting code with clear names
80529
- - Add comments for complex logic
80530
-
80531
- You have access to:
80532
- - search: Find relevant code patterns
80533
- - query: Locate specific symbols/functions
80534
- - extract: Get full file context
80535
- - implement: Create or modify files (use carefully)
80536
- - delegate: Break down complex tasks`,
80537
- "support": `You are ProbeChat Support - a helpful assistant focused on answering questions about codebases.
80538
-
80539
- Your role is to:
80540
-
80541
- 1. Answer questions about how code works
80542
- 2. Help users locate specific functionality
80543
- 3. Explain error messages and debugging approaches
80544
- 4. Guide users to relevant documentation
80545
- 5. Provide examples and usage patterns
80546
-
80547
- When helping users:
80548
- - Ask clarifying questions if the request is ambiguous
80549
- - Use search/query to find relevant code quickly
80550
- - Provide clear, step-by-step explanations
80551
- - Include code examples when helpful
80552
- - Point to relevant files and line numbers
80553
-
80554
- You should be:
80555
- - Patient and encouraging
80556
- - Clear and concise
80557
- - Thorough but not overwhelming
80558
- - Honest about limitations (say "I don't know" when appropriate)`
80478
+ - Look for bugs, edge cases, and potential issues
80479
+ - Identify performance bottlenecks and optimization opportunities
80480
+ - Check for security vulnerabilities and best practices
80481
+ - Evaluate code style and consistency
80482
+ - Provide specific, actionable suggestions with code examples where appropriate`,
80483
+ "code-review-template": `You are going to perform code review according to provided user rules. Ensure to review only code provided in diff and latest commit, if provided. However you still need to fully understand how modified code works, and read dependencies if something is not clear.`,
80484
+ "engineer": `You are senior engineer focused on software architecture and design.
80485
+ Before jumping on the task you first, in details analyse user request, and try to provide elegant and concise solution.
80486
+ If solution is clear, you can jump to implementation right away, if not, you can ask user a clarification question, by calling attempt_completion tool, with required details.
80487
+
80488
+ Before jumping to implementation:
80489
+ - Focus on high-level design patterns and system organization
80490
+ - Identify architectural patterns and component relationships
80491
+ - Evaluate system structure and suggest architectural improvements
80492
+ - Focus on backward compatibility.
80493
+ - Consider scalability, maintainability, and extensibility in your analysis
80494
+
80495
+ During the implementation:
80496
+ - Avoid implementing special cases
80497
+ - Do not forget to add the tests`,
80498
+ "support": `You are ProbeChat Support, a specialized AI assistant focused on helping developers troubleshoot issues and solve problems. Your primary function is to help users diagnose errors, understand unexpected behaviors, and find solutions using the provided code analysis tools.
80499
+
80500
+ When troubleshooting:
80501
+ - Focus on finding root causes, not just symptoms
80502
+ - Explain concepts clearly with appropriate context
80503
+ - Provide step-by-step guidance to solve problems
80504
+ - Suggest diagnostic steps to verify solutions
80505
+ - Consider edge cases and potential complications
80506
+ - Be empathetic and patient in your explanations`
80559
80507
  };
80560
80508
  }
80561
80509
  });
@@ -84998,70 +84946,20 @@ Follow these instructions carefully:
84998
84946
  - Use 'create' for new files or complete file rewrites` : ""}
84999
84947
  </instructions>
85000
84948
  `;
85001
- const predefinedPrompts2 = {
85002
- "code-explorer": `You are ProbeChat Code Explorer, a specialized AI assistant focused on helping developers, product managers, and QAs understand and navigate codebases. Your primary function is to answer questions based on code, explain how systems work, and provide insights into code functionality using the provided code analysis tools.
85003
-
85004
- When exploring code:
85005
- - Provide clear, concise explanations based on user request
85006
- - Find and highlight the most relevant code snippets, if required
85007
- - Trace function calls and data flow through the system
85008
- - Try to understand the user's intent and provide relevant information
85009
- - Understand high level picture
85010
- - Balance detail with clarity in your explanations`,
85011
- "architect": `You are ProbeChat Architect, a specialized AI assistant focused on software architecture and design. Your primary function is to help users understand, analyze, and design software systems using the provided code analysis tools.
85012
-
85013
- When analyzing code:
85014
- - Focus on high-level design patterns and system organization
85015
- - Identify architectural patterns and component relationships
85016
- - Evaluate system structure and suggest architectural improvements
85017
- - Consider scalability, maintainability, and extensibility in your analysis`,
85018
- "code-review": `You are ProbeChat Code Reviewer, a specialized AI assistant focused on code quality and best practices. Your primary function is to help users identify issues, suggest improvements, and ensure code follows best practices using the provided code analysis tools.
85019
-
85020
- When reviewing code:
85021
- - Look for bugs, edge cases, and potential issues
85022
- - Identify performance bottlenecks and optimization opportunities
85023
- - Check for security vulnerabilities and best practices
85024
- - Evaluate code style and consistency
85025
- - Provide specific, actionable suggestions with code examples where appropriate`,
85026
- "code-review-template": `You are going to perform code review according to provided user rules. Ensure to review only code provided in diff and latest commit, if provided. However you still need to fully understand how modified code works, and read dependencies if something is not clear.`,
85027
- "engineer": `You are senior engineer focused on software architecture and design.
85028
- Before jumping on the task you first, in details analyse user request, and try to provide elegant and concise solution.
85029
- If solution is clear, you can jump to implementation right away, if not, you can ask user a clarification question, by calling attempt_completion tool, with required details.
85030
-
85031
- Before jumping to implementation:
85032
- - Focus on high-level design patterns and system organization
85033
- - Identify architectural patterns and component relationships
85034
- - Evaluate system structure and suggest architectural improvements
85035
- - Focus on backward compatibility.
85036
- - Consider scalability, maintainability, and extensibility in your analysis
85037
-
85038
- During the implementation:
85039
- - Avoid implementing special cases
85040
- - Do not forget to add the tests`,
85041
- "support": `You are ProbeChat Support, a specialized AI assistant focused on helping developers troubleshoot issues and solve problems. Your primary function is to help users diagnose errors, understand unexpected behaviors, and find solutions using the provided code analysis tools.
85042
-
85043
- When troubleshooting:
85044
- - Focus on finding root causes, not just symptoms
85045
- - Explain concepts clearly with appropriate context
85046
- - Provide step-by-step guidance to solve problems
85047
- - Suggest diagnostic steps to verify solutions
85048
- - Consider edge cases and potential complications
85049
- - Be empathetic and patient in your explanations`
85050
- };
85051
84949
  let systemMessage = "";
85052
84950
  if (this.customPrompt) {
85053
84951
  systemMessage = "<role>" + this.customPrompt + "</role>";
85054
84952
  if (this.debug) {
85055
84953
  console.log(`[DEBUG] Using custom prompt`);
85056
84954
  }
85057
- } else if (this.promptType && predefinedPrompts2[this.promptType]) {
85058
- systemMessage = "<role>" + predefinedPrompts2[this.promptType] + "</role>";
84955
+ } else if (this.promptType && predefinedPrompts[this.promptType]) {
84956
+ systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
85059
84957
  if (this.debug) {
85060
84958
  console.log(`[DEBUG] Using predefined prompt: ${this.promptType}`);
85061
84959
  }
85062
84960
  systemMessage += commonInstructions;
85063
84961
  } else {
85064
- systemMessage = "<role>" + predefinedPrompts2["code-explorer"] + "</role>";
84962
+ systemMessage = "<role>" + predefinedPrompts["code-explorer"] + "</role>";
85065
84963
  if (this.debug) {
85066
84964
  console.log(`[DEBUG] Using default prompt: code explorer`);
85067
84965
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc189",
3
+ "version": "0.6.0-rc191",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -1807,63 +1807,7 @@ Follow these instructions carefully:
1807
1807
  </instructions>
1808
1808
  `;
1809
1809
 
1810
- // Define predefined prompts (without the common instructions)
1811
- const predefinedPrompts = {
1812
- 'code-explorer': `You are ProbeChat Code Explorer, a specialized AI assistant focused on helping developers, product managers, and QAs understand and navigate codebases. Your primary function is to answer questions based on code, explain how systems work, and provide insights into code functionality using the provided code analysis tools.
1813
-
1814
- When exploring code:
1815
- - Provide clear, concise explanations based on user request
1816
- - Find and highlight the most relevant code snippets, if required
1817
- - Trace function calls and data flow through the system
1818
- - Try to understand the user's intent and provide relevant information
1819
- - Understand high level picture
1820
- - Balance detail with clarity in your explanations`,
1821
-
1822
- 'architect': `You are ProbeChat Architect, a specialized AI assistant focused on software architecture and design. Your primary function is to help users understand, analyze, and design software systems using the provided code analysis tools.
1823
-
1824
- When analyzing code:
1825
- - Focus on high-level design patterns and system organization
1826
- - Identify architectural patterns and component relationships
1827
- - Evaluate system structure and suggest architectural improvements
1828
- - Consider scalability, maintainability, and extensibility in your analysis`,
1829
-
1830
- 'code-review': `You are ProbeChat Code Reviewer, a specialized AI assistant focused on code quality and best practices. Your primary function is to help users identify issues, suggest improvements, and ensure code follows best practices using the provided code analysis tools.
1831
-
1832
- When reviewing code:
1833
- - Look for bugs, edge cases, and potential issues
1834
- - Identify performance bottlenecks and optimization opportunities
1835
- - Check for security vulnerabilities and best practices
1836
- - Evaluate code style and consistency
1837
- - Provide specific, actionable suggestions with code examples where appropriate`,
1838
-
1839
- 'code-review-template': `You are going to perform code review according to provided user rules. Ensure to review only code provided in diff and latest commit, if provided. However you still need to fully understand how modified code works, and read dependencies if something is not clear.`,
1840
-
1841
- 'engineer': `You are senior engineer focused on software architecture and design.
1842
- Before jumping on the task you first, in details analyse user request, and try to provide elegant and concise solution.
1843
- If solution is clear, you can jump to implementation right away, if not, you can ask user a clarification question, by calling attempt_completion tool, with required details.
1844
-
1845
- Before jumping to implementation:
1846
- - Focus on high-level design patterns and system organization
1847
- - Identify architectural patterns and component relationships
1848
- - Evaluate system structure and suggest architectural improvements
1849
- - Focus on backward compatibility.
1850
- - Consider scalability, maintainability, and extensibility in your analysis
1851
-
1852
- During the implementation:
1853
- - Avoid implementing special cases
1854
- - Do not forget to add the tests`,
1855
-
1856
- 'support': `You are ProbeChat Support, a specialized AI assistant focused on helping developers troubleshoot issues and solve problems. Your primary function is to help users diagnose errors, understand unexpected behaviors, and find solutions using the provided code analysis tools.
1857
-
1858
- When troubleshooting:
1859
- - Focus on finding root causes, not just symptoms
1860
- - Explain concepts clearly with appropriate context
1861
- - Provide step-by-step guidance to solve problems
1862
- - Suggest diagnostic steps to verify solutions
1863
- - Consider edge cases and potential complications
1864
- - Be empathetic and patient in your explanations`
1865
- };
1866
-
1810
+ // Use predefined prompts from shared module (imported at top of file)
1867
1811
  let systemMessage = '';
1868
1812
 
1869
1813
  // Use custom prompt if provided
@@ -14,6 +14,7 @@ import {
14
14
  } from '@modelcontextprotocol/sdk/types.js';
15
15
  import { readFileSync, existsSync } from 'fs';
16
16
  import { resolve } from 'path';
17
+ import { extract } from '../index.js';
17
18
  import { initializeSimpleTelemetryFromOptions, SimpleAppTracer } from './simpleTelemetry.js';
18
19
  import {
19
20
  cleanSchemaResponse,
@@ -395,11 +396,30 @@ class ProbeAgentMcpServer {
395
396
  required: ['query']
396
397
  },
397
398
  },
399
+ {
400
+ name: 'extract_code',
401
+ description: "Extract full code blocks from files using tree-sitter AST parsing. Use this to get complete code content based on file paths and symbols returned by search_code. Each file path can include optional line numbers or symbol names to extract specific code blocks.",
402
+ inputSchema: {
403
+ type: 'object',
404
+ properties: {
405
+ path: {
406
+ type: 'string',
407
+ description: 'Absolute path to the project root directory (used as working directory for relative file paths).',
408
+ },
409
+ files: {
410
+ type: 'array',
411
+ items: { type: 'string' },
412
+ description: 'Array of file paths to extract from. Formats: "file.js" (entire file), "file.js:42" (code block at line 42), "file.js:10-20" (lines 10-20), "file.js#funcName" (specific symbol). Line numbers and symbols are part of the path string, not separate parameters. Paths can be absolute or relative to the project directory.',
413
+ }
414
+ },
415
+ required: ['path', 'files'],
416
+ },
417
+ },
398
418
  ],
399
419
  }));
400
420
 
401
421
  this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
402
- if (request.params.name !== 'search_code') {
422
+ if (request.params.name !== 'search_code' && request.params.name !== 'extract_code') {
403
423
  throw new McpError(
404
424
  ErrorCode.MethodNotFound,
405
425
  `Unknown tool: ${request.params.name}`
@@ -409,6 +429,42 @@ class ProbeAgentMcpServer {
409
429
  try {
410
430
  const args = request.params.arguments;
411
431
 
432
+ // Handle extract_code tool
433
+ if (request.params.name === 'extract_code') {
434
+ // Validate required parameters
435
+ if (!args.path) {
436
+ throw new Error("Path is required");
437
+ }
438
+ if (!args.files || !Array.isArray(args.files) || args.files.length === 0) {
439
+ throw new Error("Files array is required and must not be empty");
440
+ }
441
+
442
+ // Build options with smart defaults
443
+ const options = {
444
+ files: args.files,
445
+ path: args.path,
446
+ format: 'xml',
447
+ allowTests: true, // Include test files by default
448
+ };
449
+
450
+ if (process.env.DEBUG === '1') {
451
+ console.error('[DEBUG] Executing extract_code with options:', JSON.stringify(options, null, 2));
452
+ }
453
+
454
+ // Execute the extract command
455
+ const result = await extract(options);
456
+
457
+ return {
458
+ content: [
459
+ {
460
+ type: 'text',
461
+ text: result,
462
+ },
463
+ ],
464
+ };
465
+ }
466
+
467
+ // Handle search_code tool
412
468
  // Validate required fields
413
469
  if (!args.query) {
414
470
  throw new Error("Query is required");
@@ -554,7 +610,7 @@ class ProbeAgentMcpServer {
554
610
  ],
555
611
  };
556
612
  } catch (error) {
557
- console.error(`Error executing search_code:`, error);
613
+ console.error(`Error executing ${request.params.name}:`, error);
558
614
  return {
559
615
  content: [
560
616
  {