Skip to main content
Glama

start_profiling

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

Instructions

Start profiling to track memory usage and execution time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'start_profiling' tool. It invokes Profiler.startSession() to begin a new profiling session and returns success response with session ID.
    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.', }), }, ], }; }
  • Registration of the 'start_profiling' MCP tool using server.tool(), with empty input parameters schema.
    server.tool( 'start_profiling', 'Start profiling to track memory usage and execution time', {},
  • Core implementation in Profiler.startSession(): creates and returns a new ProfilingSession object, ending any previous active session if exists.
    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