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); }

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