Skip to main content
Glama

remove_instruments

Remove debug instrumentation from code files to clean up after debugging sessions. Specify a file path or clear all instrumented files.

Instructions

Remove debug instruments from files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoPath to file to remove instruments from. If not specified, removes from all instrumented files.

Implementation Reference

  • Executes the remove_instruments tool by removing debug instruments from a specified file or all files, updating both the code via Instrumenter and the session tracking.
    case 'remove_instruments': {
      if (!sessionManager.isActive() || !instrumenter) {
        return {
          content: [{ type: 'text', text: 'No active debug session.' }],
          isError: true,
        };
      }
    
      const file = args?.file as string | undefined;
    
      if (file) {
        // Remove from specific file
        const instruments = sessionManager.getInstrumentsByFile(file);
        for (const instrument of instruments) {
          instrumenter.removeInstrument(instrument);
          sessionManager.removeInstrument(instrument.id);
        }
        return {
          content: [
            {
              type: 'text',
              text: `Removed ${instruments.length} instrument(s) from ${file}`,
            },
          ],
        };
      } else {
        // Remove from all files
        const instruments = sessionManager.getInstruments();
        for (const instrument of instruments) {
          instrumenter.removeInstrument(instrument);
        }
        sessionManager.clearInstruments();
        return {
          content: [
            {
              type: 'text',
              text: `Removed ${instruments.length} instrument(s) from all files`,
            },
          ],
        };
      }
    }
  • Defines the input schema for the remove_instruments tool, with an optional 'file' property.
    inputSchema: {
      type: 'object',
      properties: {
        file: {
          type: 'string',
          description: 'Path to file to remove instruments from. If not specified, removes from all instrumented files.',
        },
      },
    },
  • src/index.ts:80-92 (registration)
    Registers the remove_instruments tool in the list returned by ListToolsRequestHandler.
    {
      name: 'remove_instruments',
      description: 'Remove debug instruments from files.',
      inputSchema: {
        type: 'object',
        properties: {
          file: {
            type: 'string',
            description: 'Path to file to remove instruments from. If not specified, removes from all instrumented files.',
          },
        },
      },
    },
  • Instrumenter.removeInstrument: Core logic to remove the specific debug instrumentation code block from the target file by replacing the region with regex.
    removeInstrument(instrument: Instrument): boolean {
      if (!existsSync(instrument.file)) {
        return false;
      }
    
      const content = readFileSync(instrument.file, 'utf-8');
      const regionId = `${REGION_PREFIX}-${instrument.id}`;
    
      const newContent = this.removeRegion(content, regionId, instrument.language);
    
      if (newContent !== content) {
        writeFileSync(instrument.file, newContent);
        return true;
      }
    
      return false;
    }
  • SessionManager.removeInstrument: Removes the instrument tracking entry from the session's instruments Map.
    removeInstrument(id: string): boolean {
      if (!this.session) {
        throw new Error('No active debug session');
      }
      return this.session.instruments.delete(id);
    }
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 states the action ('remove') but doesn't clarify if this is destructive, irreversible, or requires specific permissions. It also omits details like error handling or what happens if no instruments are present, which are critical for a mutation tool.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose with no wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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?

Given the tool's complexity (a mutation operation with no annotations and no output schema), the description is insufficient. It doesn't explain the return values, error conditions, or behavioral nuances, leaving significant gaps for an agent to understand how to use it effectively.

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

Parameters3/5

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

The input schema has 100% description coverage, fully documenting the single parameter. The description adds no additional meaning beyond the schema's explanation of the 'file' parameter, so it meets the baseline of 3 without compensating for any gaps.

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

Purpose4/5

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

The description clearly states the action ('remove') and target ('debug instruments from files'), which is specific and understandable. However, it doesn't explicitly distinguish this tool from its sibling 'clear_debug_logs' or 'list_instruments', which might also involve instrument management, so it misses full sibling differentiation.

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 like 'clear_debug_logs' or 'list_instruments'. It lacks context about prerequisites (e.g., whether instruments must exist first) or exclusions, leaving the agent to infer usage from the name alone.

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

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/iarmankhan/agentic-debugger'

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