Skip to main content
Glama
evalops

Deep Code Reasoning MCP Server

by evalops

performance_bottleneck

Identify and analyze performance bottlenecks in code using deep execution modeling. Input code path and suspected issues to pinpoint inefficiencies and optimize system performance.

Instructions

Use Gemini for deep performance analysis with execution modeling

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
code_pathYes
profile_depthNo

Implementation Reference

  • MCP tool handler for 'performance_bottleneck': parses input schema, validates file paths, invokes DeepCodeReasonerV2.analyzePerformance, formats and returns result as MCP content.
    case 'performance_bottleneck': {
      const parsed = PerformanceBottleneckSchema.parse(args);
    
      // Validate the entry point file path
      const validatedPath = InputValidator.validateFilePaths([parsed.code_path.entry_point.file])[0];
      if (!validatedPath) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid entry point file path',
        );
      }
    
      const result = await deepReasoner.analyzePerformance(
        { ...parsed.code_path.entry_point, file: validatedPath },
        parsed.profile_depth,
        parsed.code_path.suspected_issues ?
          InputValidator.validateStringArray(parsed.code_path.suspected_issues) :
          undefined,
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Zod schema defining input validation for performance_bottleneck tool: code_path with entry_point and optional suspected_issues, plus profile_depth.
    const PerformanceBottleneckSchema = z.object({
      code_path: z.object({
        entry_point: z.object({
          file: z.string(),
          line: z.number(),
          function_name: z.string().optional(),
        }),
        suspected_issues: z.array(z.string()).optional(),
      }),
      profile_depth: z.number().min(1).max(5).default(3),
    });
  • src/index.ts:277-303 (registration)
    Tool registration in MCP listTools handler: defines name, description, and JSON schema matching the Zod schema for input validation.
    {
      name: 'performance_bottleneck',
      description: 'Use Gemini for deep performance analysis with execution modeling',
      inputSchema: {
        type: 'object',
        properties: {
          code_path: {
            type: 'object',
            properties: {
              entry_point: {
                type: 'object',
                properties: {
                  file: { type: 'string' },
                  line: { type: 'number' },
                  function_name: { type: 'string' },
                },
                required: ['file', 'line'],
              },
              suspected_issues: { type: 'array', items: { type: 'string' } },
            },
            required: ['entry_point'],
          },
          profile_depth: { type: 'number', minimum: 1, maximum: 5, default: 3 },
        },
        required: ['code_path'],
      },
    },
  • Core performance analysis helper invoked by tool handler: gathers relevant code files using performance patterns, delegates to GeminiService.performPerformanceAnalysis.
    async analyzePerformance(
      entryPoint: CodeLocation,
      profileDepth: number = 3,
      suspectedIssues?: string[],
    ): Promise<{
      analysis: string;
      filesAnalyzed: string[];
    }> {
      const codeFiles = new Map<string, string>();
    
      // Read entry point and related files
      codeFiles.set(entryPoint.file, await this.codeReader.readFile(entryPoint.file));
    
      // Find files that might affect performance
      const performancePatterns = ['Service', 'Repository', 'Query', 'Cache', 'Database'];
      const relatedFiles = await this.codeReader.findRelatedFiles(entryPoint.file, performancePatterns);
    
      // Read up to profileDepth related files
      for (let i = 0; i < Math.min(relatedFiles.length, profileDepth * 3); i++) {
        try {
          const content = await this.codeReader.readFile(relatedFiles[i]);
          codeFiles.set(relatedFiles[i], content);
        } catch (error) {
          // Skip unreadable files
        }
      }
    
      // Use Gemini for performance analysis
      const analysis = await this.geminiService.performPerformanceAnalysis(
        codeFiles,
        suspectedIssues || [],
      );
    
      return {
        analysis,
        filesAnalyzed: Array.from(codeFiles.keys()),
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'deep performance analysis with execution modeling' but doesn't describe what this entails operationally - whether it's a read-only analysis, if it modifies code, what permissions are needed, how long it takes, or what the output format might be. The description is too high-level to provide meaningful behavioral context for a tool with complex nested parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence with 8 words. It's front-loaded with the core information (uses Gemini for performance analysis). While perhaps too brief given the tool's complexity, every word serves a purpose and there's no redundancy or wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with complex nested parameters (code_path with entry_point object), no annotations, no output schema, and 0% schema description coverage, the description is inadequate. It doesn't explain what the tool returns, how to interpret results, what 'execution modeling' means, or provide any context about the analysis process. The description leaves too many open questions for effective tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 2 parameters (one being a complex nested object), the description provides no information about parameters. It doesn't mention 'code_path', 'entry_point', 'suspected_issues', or 'profile_depth' at all. The description fails to compensate for the complete lack of schema documentation, leaving the agent with no semantic understanding of what inputs are expected.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool uses Gemini for 'deep performance analysis with execution modeling', which gives a vague purpose but doesn't specify what resource is being analyzed or what specific action is performed. It mentions 'performance analysis' but doesn't clarify if this is profiling, bottleneck detection, optimization suggestions, or something else. The description distinguishes from siblings by mentioning Gemini, but the purpose remains somewhat ambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, appropriate contexts, or exclusions. Given the sibling tools include 'trace_execution_path', 'hypothesis_test', and 'escalate_analysis', there's no indication of when performance_bottleneck is preferred over these other analysis tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/evalops/deep-code-reasoning-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server