# List Sitemaps — Google Search Console

> Lists the sitemaps Google Search Console knows about for a property, with their error, warning and freshness state normalized to numbers.

- Key: `google_search_console-list-sitemaps`
- Type: Action (Read-only)
- Version: 0.0.1
- App: Google Search Console (`google_search_console`) — https://pipedream.com/apps/google-search-console.md
- This page (HTML): https://pipedream.com/apps/google-search-console/actions/list-sitemaps
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_search_console/actions/list-sitemaps/list-sitemaps.mjs

## Description

Lists the sitemaps Google Search Console knows about for a property, with their error, warning and freshness state normalized to numbers.

**Use for** any sitemap question — which are submitted, which have errors or warnings, when Google last downloaded one, how many URLs it contains. Always call it before **Delete Sitemap** when the user has not named an exact sitemap URL, and after **Submit Sitemap** or **Delete Sitemap** to confirm the new state: in both cases leave `sitemapUrl` empty and look for the `path`, because a single-path lookup of a deleted or unknown sitemap returns 404.

**Not for** whether the URLs inside a sitemap are indexed (use **Inspect URLs**). This tool reports what Google recorded about a sitemap; it does not fetch or parse the XML itself.

**Returns** `{ sitemaps: [...], count, summary: { with_errors, with_warnings, pending, never_downloaded } }`. `path` is the full sitemap URL and is the exact string to pass to **Submit Sitemap** or **Delete Sitemap**. `warnings`, `errors` and `submitted_urls` are integers here (the raw API returns strings); `submitted_urls` is the sum of `contents[].submitted`. `isPending: true` means Google accepted the sitemap but has not fetched it yet. A sitemap with no `lastDownloaded` has never been downloaded and is counted in `summary.never_downloaded`.

**Mistakes.** Do not guess a sitemap URL — list first and use a `path` from the result; an unknown path returns 404 "'<url>' is not a submitted or a known sitemap." `lastDownloaded` can be years old while the sitemap is still valid, so report the date rather than treating it as an error. `errors` and `warnings` count sitemap-parsing problems, not indexing problems.

**Example.** `siteUrl="sc-domain:example.com"` with no other input returns `{ count: 3, summary: { with_errors: 1, ... }, sitemaps: [{ path: "https://www.example.com/sitemap.xml", lastDownloaded: "2018-05-06T02:44:10.000Z", errors: 1, warnings: 1, submitted_urls: 2, contents: [{ type: "web", submitted: "2", indexed: "0" }] }, ...] }` — so "when was it last downloaded and how many URLs?" is 6 May 2018 and 2 URLs.

[See the documentation](https://developers.google.com/webmaster-tools/v1/sitemaps/list)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `siteUrl` | `string` | Yes | Exact property identifier from List Sites — sc-domain:example.com for a domain property, or a URL-prefix such as https://www.example.com/ (trailing slash; scheme and subdomain must match exactly, or the call 403s). Copy it verbatim, never construct it. For traffic questions prefer the domain property when one exists: it covers all subdomains and protocols. |
| `sitemapUrl` | `string` | No | Optional. Full URL of one sitemap, to return just that sitemap. Leave empty to list every sitemap for the property. An unknown URL returns 404 "'<url>' is not a submitted or a known sitemap.", so do not use this to check whether a sitemap exists or was deleted — list everything and look for the path. |
| `sitemapIndex` | `string` | No | Optional. Full URL of a sitemap index, e.g. https://www.example.com/sitemap_index.xml. When set, only the child sitemaps inside that index are listed. Leave empty to list all sitemaps, and never set it together with Sitemap URL (the call fails if both are set). To find an index URL, call this action with no filters and take the path of an entry whose isSitemapsIndex is true. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "google_search_console",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "google_search_console-list-sitemaps",
  arguments: {
    siteUrl: "Property (siteUrl)",
    sitemapUrl: "Sitemap URL",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "google_search_console-list-sitemaps",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_search_console: { authProvisionId: "apn_xxxxxxx" },
    siteUrl: "Property (siteUrl)",
    sitemapUrl: "Sitemap URL",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "google_search_console-list-sitemaps",
    "configured_props": {
      "google_search_console": { "authProvisionId": "apn_xxxxxxx" },
      "siteUrl": "Property (siteUrl)",
      "sitemapUrl": "Sitemap URL"
    }
  }'
```

---

- App: https://pipedream.com/apps/google-search-console.md · All apps: https://pipedream.com/apps
