Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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
              ),
            },
          ],
        };
      }
    );
  • 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());
    }
  • Empty input schema for the list_watches tool (no parameters required).
    {},

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