list_watches
Display active watch expressions to monitor variable values during PHP debugging sessions with Xdebug.
Instructions
List all active watch expressions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/advanced.ts:121-148 (handler)MCP tool registration and handler for 'list_watches'. Retrieves all watches using WatchManager.getAllWatches() and returns a JSON-formatted list including id, expression, lastValue, hasChanged, and evaluationCount.server.tool( 'list_watches', 'List all active watch expressions', {}, async () => { const watches = ctx.watchManager.getAllWatches(); return { content: [ { type: 'text', text: JSON.stringify( { watches: watches.map((w) => ({ id: w.id, expression: w.expression, lastValue: w.lastValue, hasChanged: w.hasChanged, evaluationCount: w.evaluationCount, })), }, null, 2 ), }, ], }; } );
- src/session/watch-manager.ts:66-68 (helper)Helper method in WatchManager that returns the array of all WatchExpression objects stored in the internal Map.getAllWatches(): WatchExpression[] { return Array.from(this.watches.values()); }
- src/tools/advanced.ts:124-124 (schema)Empty input schema for the list_watches tool (no parameters required).{},