Skip to main content
Glama

load_debug_profile

Load a saved debug profile to resume debugging PHP applications with breakpoints, variable inspection, and stack traces.

Instructions

Load a saved debug profile

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesProfile name to load

Implementation Reference

  • The async handler function for the load_debug_profile tool. It fetches the profile from configManager, clears and reloads watches, step filters, logpoints, sets active profile, and returns load summary.
    async ({ name }) => {
      const profile = ctx.configManager.getProfile(name);
      if (!profile) {
        return {
          content: [{ type: 'text', text: JSON.stringify({ error: `Profile not found: ${name}` }) }],
        };
      }
    
      // Clear current settings
      ctx.watchManager.clearAllWatches();
    
      // Load watches
      for (const expr of profile.watchExpressions) {
        ctx.watchManager.addWatch(expr);
      }
    
      // Load step filters
      ctx.stepFilter.importConfig(profile.stepFilters);
    
      // Load logpoints
      for (const lp of profile.logpoints) {
        ctx.logpointManager.createLogpoint(lp.file, lp.line, lp.message, lp.condition);
      }
    
      ctx.configManager.setActiveProfile(name);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              loaded: {
                name: profile.name,
                breakpoints: profile.breakpoints.length,
                watches: profile.watchExpressions.length,
                filters: profile.stepFilters.length,
                logpoints: profile.logpoints.length,
              },
              note: 'Breakpoints need to be set manually using set_breakpoint for each entry',
            }),
          },
        ],
      };
    }
  • Input schema for the tool: requires 'name' string parameter identifying the profile to load.
    {
      name: z.string().describe('Profile name to load'),
    },
  • Direct registration of the load_debug_profile tool using server.tool() in advanced tools module.
    server.tool(
      'load_debug_profile',
      'Load a saved debug profile',
      {
        name: z.string().describe('Profile name to load'),
      },
      async ({ name }) => {
        const profile = ctx.configManager.getProfile(name);
        if (!profile) {
          return {
            content: [{ type: 'text', text: JSON.stringify({ error: `Profile not found: ${name}` }) }],
          };
        }
    
        // Clear current settings
        ctx.watchManager.clearAllWatches();
    
        // Load watches
        for (const expr of profile.watchExpressions) {
          ctx.watchManager.addWatch(expr);
        }
    
        // Load step filters
        ctx.stepFilter.importConfig(profile.stepFilters);
    
        // Load logpoints
        for (const lp of profile.logpoints) {
          ctx.logpointManager.createLogpoint(lp.file, lp.line, lp.message, lp.condition);
        }
    
        ctx.configManager.setActiveProfile(name);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: true,
                loaded: {
                  name: profile.name,
                  breakpoints: profile.breakpoints.length,
                  watches: profile.watchExpressions.length,
                  filters: profile.stepFilters.length,
                  logpoints: profile.logpoints.length,
                },
                note: 'Breakpoints need to be set manually using set_breakpoint for each entry',
              }),
            },
          ],
        };
      }
    );
  • Top-level registration call to registerAdvancedTools, which includes the load_debug_profile tool among advanced tools.
    registerAdvancedTools(server, ctx as AdvancedToolsContext);
  • DebugConfigManager.getProfile(name) method called by the handler to retrieve the DebugProfile data from in-memory map.
    getProfile(name: string): DebugProfile | undefined {
      return this.profiles.get(name);
    }
  • TypeScript interface defining the structure of a DebugProfile used by the tool.
    export interface DebugProfile {
      name: string;
      description?: string;
      createdAt: Date;
      updatedAt: Date;
      breakpoints: BreakpointConfig[];
      watchExpressions: string[];
      logpoints: Array<{
        file: string;
        line: number;
        message: string;
        condition?: string;
      }>;
      stepFilters: Array<{
        pattern: string;
        type: 'include' | 'exclude';
        enabled: boolean;
      }>;
      settings: {
        maxDepth?: number;
        maxChildren?: number;
        skipVendor?: boolean;
      };
    }

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/kpanuragh/xdebug-mcp'

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