Skip to main content
Glama

add_logpoint

Insert logpoints in PHP code to output variable values during execution without interrupting program flow, using {varName} placeholders for dynamic logging.

Instructions

Add a logpoint that logs messages without stopping execution. Use {varName} placeholders for variables.

Input Schema

NameRequiredDescriptionDefault
fileYesFile path
lineYesLine number
messageYesMessage template with {var} placeholders (e.g., 'User {$userId} logged in')
conditionNoOptional condition

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "condition": { "description": "Optional condition", "type": "string" }, "file": { "description": "File path", "type": "string" }, "line": { "description": "Line number", "type": "integer" }, "message": { "description": "Message template with {var} placeholders (e.g., 'User {$userId} logged in')", "type": "string" } }, "required": [ "file", "line", "message" ], "type": "object" }

Implementation Reference

  • MCP tool registration for 'add_logpoint', including input schema, description, and handler function that delegates creation to LogpointManager.createLogpoint and returns formatted response.
    server.tool( 'add_logpoint', 'Add a logpoint that logs messages without stopping execution. Use {varName} placeholders for variables.', { file: z.string().describe('File path'), line: z.number().int().describe('Line number'), message: z.string().describe("Message template with {var} placeholders (e.g., 'User {$userId} logged in')"), condition: z.string().optional().describe('Optional condition'), }, async ({ file, line, message, condition }) => { const logpoint = ctx.logpointManager.createLogpoint(file, line, message, condition); return { content: [ { type: 'text', text: JSON.stringify({ success: true, logpoint: { id: logpoint.id, file, line, message, condition, }, }), }, ], }; } );
  • Core implementation of logpoint creation: generates unique ID, initializes Logpoint object with properties, stores in internal map, and logs the creation.
    createLogpoint( file: string, line: number, message: string, condition?: string ): Logpoint { const id = `logpoint_${++this.logpointIdCounter}`; const logpoint: Logpoint = { id, file, line, message, condition, hitCount: 0, createdAt: new Date(), enabled: true, logHistory: [], }; this.logpoints.set(id, logpoint); logger.debug(`Logpoint created: ${id} at ${file}:${line}`); return logpoint; }
  • Type definition for Logpoint objects used by the add_logpoint tool.
    export interface Logpoint { id: string; breakpointId?: string; file: string; line: number; message: string; condition?: string; hitCount: number; lastHitAt?: Date; createdAt: Date; enabled: boolean; logHistory: LogEntry[]; }

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