list_watches
Display all active watch expressions to monitor PHP variable values during debugging sessions.
Instructions
List all active watch expressions
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/advanced.ts:121-148 (handler)The complete registration block for the 'list_watches' tool, including the inline empty input schema, description, and the handler function that executes the tool logic by retrieving all watches from WatchManager and formatting them as JSON response.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)Core helper method getAllWatches() in WatchManager class that returns the array of all active watch expressions stored in the internal Map.getAllWatches(): WatchExpression[] { return Array.from(this.watches.values()); }