Skip to main content
Glama

add_step_filter

Skip specific files or directories during PHP debugging to avoid stepping through vendor code or other unwanted paths using pattern matching.

Instructions

Add a step filter to skip certain files/directories during stepping (e.g., vendor code)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesPattern to match (e.g., '/vendor/', '*.min.js', '/regex/')
typeYesinclude = step into, exclude = skip
descriptionNoDescription of the filter

Implementation Reference

  • MCP tool registration for 'add_step_filter', including input schema (Zod) and handler function that calls StepFilter.addRule and returns success response.
    server.tool(
      'add_step_filter',
      'Add a step filter to skip certain files/directories during stepping (e.g., vendor code)',
      {
        pattern: z.string().describe("Pattern to match (e.g., '/vendor/', '*.min.js', '/regex/')"),
        type: z.enum(['include', 'exclude']).describe('include = step into, exclude = skip'),
        description: z.string().optional().describe('Description of the filter'),
      },
      async ({ pattern, type, description }) => {
        const rule = ctx.stepFilter.addRule(pattern, type, description);
        return {
          content: [{ type: 'text', text: JSON.stringify({ success: true, rule }) }],
        };
      }
    );
  • Implementation of the addRule method in the StepFilter class, which creates a unique filter rule, stores it in the rules Map, logs it, and returns the rule object.
    /**
     * Add a step filter rule
     */
    addRule(
      pattern: string,
      type: 'include' | 'exclude',
      description?: string
    ): StepFilterRule {
      const id = `filter_${++this.ruleIdCounter}`;
      const rule: StepFilterRule = {
        id,
        pattern,
        type,
        enabled: true,
        description,
      };
      this.rules.set(id, rule);
      logger.debug(`Step filter rule added: ${id} - ${type} ${pattern}`);
      return rule;
    }

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