Skip to main content
Glama
patchwindow

seo-mcp

by patchwindow

gsc_sitemap_list

Retrieve all sitemaps submitted to Google Search Console for a given site, including their status, URL count, and last submission date.

Instructions

List all sitemaps submitted to Google Search Console for a site, including their status, URL counts, and last submission date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
site_urlNoSite URL in GSC format, e.g. 'sc-domain:example.com'. Uses config default if omitted.

Implementation Reference

  • The main handler function that authenticates via OAuth2, calls the GSC sitemaps.list API, formats the sitemap data into a human-readable text response, and returns the result.
    handler: async (args, config) => {
      const auth = getOAuth2Client();
      const sc = google.searchconsole({ version: "v1", auth });
    
      const siteUrl = args.site_url ?? config.gsc?.default_site;
      if (!siteUrl) {
        throw new Error(
          "site_url is required. Pass it as an argument or set gsc.default_site in ~/.seo-mcp/config.json"
        );
      }
    
      const res = await sc.sitemaps.list({ siteUrl });
      const sitemaps = res.data.sitemap ?? [];
    
      if (sitemaps.length === 0) {
        return { content: [{ type: "text", text: `No sitemaps found for ${siteUrl}.` }] };
      }
    
      const lines = sitemaps.map((sm) => {
        const submitted = sm.lastSubmitted ?? "—";
        const downloaded = sm.lastDownloaded ?? "—";
        const warnings = Number(sm.warnings ?? 0);
        const errors = Number(sm.errors ?? 0);
    
        const countSummary = (sm.contents ?? [])
          .map((c) => `${c.type}: ${c.submitted ?? 0} submitted, ${c.indexed ?? 0} indexed`)
          .join(" | ");
    
        const statusParts = [];
        if (errors > 0) statusParts.push(`${errors} errors`);
        if (warnings > 0) statusParts.push(`${warnings} warnings`);
        const status = statusParts.length > 0 ? statusParts.join(", ") : "OK";
    
        return [
          `Path: ${sm.path}`,
          `  Type: ${sm.type ?? "—"} | Status: ${status}`,
          `  Submitted: ${submitted} | Downloaded: ${downloaded}`,
          countSummary ? `  Counts: ${countSummary}` : "",
        ]
          .filter(Boolean)
          .join("\n");
      });
    
      const header = `Sitemaps for ${siteUrl} (${sitemaps.length} total):\n`;
      return { content: [{ type: "text", text: header + lines.join("\n\n") }] };
    },
  • Zod schema defining the input: an optional site_url string (defaults to config's gsc.default_site).
    const schema = z.object({
      site_url: z.string().optional().describe(
        "Site URL in GSC format, e.g. 'sc-domain:example.com'. Uses config default if omitted."
      ),
    });
  • The gscSitemapList tool is registered as part of the gscTools array, exported for integration into the MCP server.
    export const gscTools: ToolDefinition[] = [
      gscSearchPerformance as unknown as ToolDefinition,
      gscStrikingDistance as unknown as ToolDefinition,
      gscTrafficDrop as unknown as ToolDefinition,
      gscUrlInspection as unknown as ToolDefinition,
      gscSitemapList as unknown as ToolDefinition,
      gscBrandNonbrand as unknown as ToolDefinition,
    ];
  • getOAuth2Client helper that reads credentials and tokens, sets up the Google OAuth2 client used by the sitemap list handler.
    export function getOAuth2Client() {
      const clientId = process.env.GSC_CLIENT_ID;
      const clientSecret = process.env.GSC_CLIENT_SECRET;
    
      if (!clientId || !clientSecret) {
        throw new Error(
          "GSC_CLIENT_ID and GSC_CLIENT_SECRET must be set.\n" +
          "Run: npx @patchwindow/seo-mcp auth gsc\n" +
          "See README for Google Cloud Console setup instructions."
        );
      }
    
      const oauth2 = new google.auth.OAuth2(clientId, clientSecret, GSC_REDIRECT_URI);
    
      const tokens = readTokens();
      if (!tokens) {
        throw new Error(
          "GSC not authenticated. Run: npx @patchwindow/seo-mcp auth gsc"
        );
      }
    
      oauth2.setCredentials(tokens);
      oauth2.on("tokens", (newTokens) => {
        writeTokens({ ...tokens, ...newTokens });
      });
    
      return oauth2;
    }
  • ToolDefinition interface that defines the shape (name, description, schema, handler) which the gscSitemapList export conforms to.
    export interface ToolDefinition<T extends AnyZodObject = AnyZodObject> {
      name: string;
      description: string;
      schema: T;
      handler: (args: z.infer<T>, config: Config) => Promise<ToolResult>;
    }
Behavior3/5

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

With no annotations, the description carries the full burden. It reveals the return fields (status, counts, date) but does not disclose read-only nature, auth needs, or behavior on invalid site_url. The disclosure is adequate for a simple list operation but lacks depth.

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?

A single sentence that is front-loaded and concise, with no redundant information. Every word serves the purpose.

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

Completeness4/5

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

Given the tool's simplicity (one optional parameter, no output schema), the description provides enough context: it lists sitemaps with status, counts, and date. It doesn't cover prerequisites like site verification, but for a straightforward list operation this is sufficient.

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

Parameters3/5

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

Schema coverage is 100% and the schema already describes the 'site_url' parameter. The description adds no extra meaning beyond the schema, so baseline 3 is appropriate.

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

Purpose5/5

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

The description uses a specific verb 'list' and resource 'sitemaps submitted to Google Search Console', clearly stating what it does and including fields returned (status, URL counts, last submission date). It distinguishes itself from sibling tools that target Bing or other GSC functions.

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

Usage Guidelines3/5

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

The description does not explicitly state when to use this tool over alternatives like bing_sitemap_list or other GSC tools. Usage context is implied by the name and description, but no when-not or alternative guidance is provided.

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/patchwindow/seo-mcp'

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