Skip to main content
Glama

mysql_list_sites

List all available Local WordPress sites and their current running status. Provides an overview of local development environments.

Instructions

List all available Local WordPress sites and their running status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool schema registration for 'mysql_list_sites' - defines the tool's name, description, and input schema (no inputs needed).
      name: 'mysql_list_sites',
      description: 'List all available Local WordPress sites and their running status',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Handler for 'mysql_list_sites' tool - calls listAvailableSites() and returns the list of sites with their running status, plus the current site ID.
    case 'mysql_list_sites': {
      try {
        const sites = listAvailableSites();
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  sites,
                  currentSiteId: currentSiteSelection?.siteInfo.siteId || null,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (listError: unknown) {
        const message = listError instanceof Error ? listError.message : String(listError);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  error: 'Failed to list sites',
                  message,
                },
                null,
                2
              ),
            },
          ],
        };
      }
    }
  • Implementation of listAvailableSites() - loads Local's sites.json config, checks each site's MySQL socket existence to determine running status, and returns site info.
    export function listAvailableSites(): Array<{
      id: string;
      name: string;
      path: string;
      domain: string;
      running: boolean;
    }> {
      const sites = loadLocalSitesConfig();
      const runDir = getLocalRunDirectory();
    
      return Object.entries(sites).map(([id, site]) => {
        const socketPath = path.join(runDir, id, 'mysql/mysqld.sock');
        return {
          id,
          name: site.name,
          path: normalizeSitePath(site.path),
          domain: site.domain,
          running: fs.existsSync(socketPath),
        };
      });
    }
  • Helper function loadLocalSitesConfig() - reads and parses Local's sites.json configuration file used by listAvailableSites.
    export function loadLocalSitesConfig(): LocalSitesConfig {
      const sitesJsonPath = getSitesJsonPath();
      debugLog(`Loading sites.json from: ${sitesJsonPath}`);
    
      const content = fs.readFileSync(sitesJsonPath, 'utf8');
      return JSON.parse(content) as LocalSitesConfig;
    }
  • Helper function getLocalRunDirectory() - determines the Local by Flywheel run directory path (platform-specific) used to find MySQL socket files for checking site running status.
    function getLocalRunDirectory(): string {
      const customPath = process.env.LOCAL_RUN_DIR;
      if (customPath && fs.existsSync(customPath)) {
        return customPath;
      }
    
      const candidates: string[] = [];
      const home = os.homedir();
    
      if (process.platform === 'darwin') {
        candidates.push(path.join(home, 'Library/Application Support/Local/run'));
      } else if (process.platform === 'win32') {
        if (process.env.LOCALAPPDATA) {
          candidates.push(path.join(process.env.LOCALAPPDATA, 'Local', 'run'));
        }
        if (process.env.APPDATA) {
          candidates.push(path.join(process.env.APPDATA, 'Local', 'run'));
        }
      } else {
        candidates.push(path.join(home, '.config', 'Local', 'run'));
        candidates.push(path.join(home, '.local', 'share', 'Local', 'run'));
      }
    
      for (const candidate of candidates) {
        if (fs.existsSync(candidate)) {
          return candidate;
        }
      }
    
      throw new Error('Local run directory not found. Set LOCAL_RUN_DIR to override.');
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so description fully carries the burden. It accurately describes a read-only list operation, which is transparent for this simple action. No hidden behaviors or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no wasted words. Efficiently communicates purpose and output.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Fully describes what the tool returns (list of sites with running status) without needing output schema. Complete for a simple list operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 0 parameters, so baseline is 4. The description does not need to add parameter info, and it doesn't repeat unnecessary details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists all available Local WordPress sites and their running status. The verb 'List' and the resource are specific, and it implicitly distinguishes from siblings like mysql_current_site (single site) or mysql_query (queries).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool vs alternatives. The description implies listing all sites, but no when-not or alternative tool mentions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/verygoodplugins/mcp-local-wp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server