Skip to main content
Glama

start_profiling

Initiate performance profiling to monitor memory consumption and execution time during PHP debugging sessions.

Instructions

Start profiling to track memory usage and execution time

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "properties": {}, "type": "object" }

Implementation Reference

  • Registers the start_profiling MCP tool, providing description, empty input schema, and an inline handler that calls Profiler.startSession() and returns success response with session ID.
    server.tool( 'start_profiling', 'Start profiling to track memory usage and execution time', {}, async () => { const session = ctx.profiler.startSession(); return { content: [ { type: 'text', text: JSON.stringify({ success: true, sessionId: session.id, message: 'Profiling started. Use step commands to collect data.', }), }, ], }; }
  • Core implementation of startSession() in Profiler class, which initializes and returns a new ProfilingSession object for tracking profiling data.
    startSession(): ProfilingSession { if (this.currentSession && !this.currentSession.endedAt) { this.endSession(); } this.currentSession = { id: `profile_${++this.sessionIdCounter}`, startedAt: new Date(), snapshots: [], functionProfiles: new Map(), totalMemorySnapshots: 0, peakMemoryUsage: 0, }; this.lastSnapshotTime = Date.now(); logger.info(`Profiling session started: ${this.currentSession.id}`); return this.currentSession; }

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