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
| Name | Required | Description | Default |
|---|---|---|---|
| sitemapIndex | No | A URL of a site's sitemap index. For example: http://www.example.com/sitemapindex.xml | |
| siteUrl | No | The site's URL, including protocol. For example: http://www.example.com/ |
Implementation Reference
- src/index.ts:309-324 (handler)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), }, ], }; }
- src/schemas.ts:60-71 (schema)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), },
- src/search-console.ts:194-204 (helper)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!), }), ); }