Skip to main content
Glama
ahonn

Google Search Console MCP Server

by ahonn

list_sitemaps

Retrieve and display all sitemaps for a website from Google Search Console to monitor and manage site structure for search engine optimization.

Instructions

List sitemaps for a site in Google Search Console

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sitemapIndexNoA URL of a site's sitemap index. For example: http://www.example.com/sitemapindex.xml
siteUrlNoThe site's URL, including protocol. For example: http://www.example.com/

Implementation Reference

  • MCP tool handler for 'list_sitemaps': parses arguments using schema, constructs request body, calls SearchConsoleService.listSitemaps, and formats response as JSON text content.
    case 'list_sitemaps': {
      const args = ListSitemapsSchema.parse(request.params.arguments);
      const requestBody = {
        siteUrl: args.siteUrl,
        sitemapIndex: args.sitemapIndex,
      };
      const response = await searchConsole.listSitemaps(requestBody);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • Zod input schema for the list_sitemaps tool, defining optional siteUrl and sitemapIndex parameters with descriptions.
    export const ListSitemapsSchema = z.object({
      sitemapIndex: z
        .string()
        .optional()
        .describe(
          "A URL of a site's sitemap index. For example: http://www.example.com/sitemapindex.xml",
        ),
      siteUrl: z
        .string()
        .optional()
        .describe("The site's URL, including protocol. For example: http://www.example.com/"),
    });
  • src/index.ts:68-72 (registration)
    Tool registration in ListTools response, specifying name, description, and input schema reference.
    {
      name: 'list_sitemaps',
      description: 'List sitemaps for a site in Google Search Console',
      inputSchema: zodToJsonSchema(ListSitemapsSchema),
    },
  • SearchConsoleService method implementing listSitemaps API call to Google Webmasters sitemaps.list with permission error fallback using URL normalization.
    async listSitemaps(requestBody: ListSitemapsRequest) {
      const webmasters = await this.getWebmasters();
      return this.handlePermissionError(
        () => webmasters.sitemaps.list(requestBody),
        () =>
          webmasters.sitemaps.list({
            ...requestBody,
            siteUrl: this.normalizeUrl(requestBody.siteUrl!),
          }),
      );
    }

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/ahonn/mcp-server-gsc'

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