# List Sites — Google Search Console

> Lists every Google Search Console property the connected Google account can access, plus that account's email address.

- Key: `google_search_console-list-sites`
- 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-sites
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_search_console/actions/list-sites/list-sites.mjs

## Description

Lists every Google Search Console property the connected Google account can access, plus that account's email address.

**Call this first** on any per-site task, unless the user already gave an exact identifier such as `sc-domain:example.com`: every other tool needs the identifier byte-for-byte, and it must be copied from here, never constructed. Call it again after a 403 to see what the account really has.

**Do NOT call it** when Search Console cannot do the task at all — backlinks or the Links report, requesting indexing of an ordinary page, adding or removing property owners. Say that first, and call this only if the user then asks for something the tools do cover.

**Returns** `{ account_email, sites: [{ siteUrl, permissionLevel, property_type }], count }`, domain properties first then alphabetical. The list is complete — the API has no pagination. `property_type` is `"domain"` for an `sc-domain:` identifier (covers every subdomain and both schemes — prefer it for traffic questions unless the user names a specific prefix) and `"url_prefix"` otherwise (an exact scheme + host + path prefix, trailing slash included). `account_email` is `null` if the email could not be read; the site list still returns.

**Permission levels.** `siteOwner` and `siteFullUser` can submit and delete sitemaps and inspect URLs (only an owner can manage users); `siteRestrictedUser` is read-only on reports and **cannot submit sitemaps or inspect URLs** (403); `siteUnverifiedUser` has no data at all. Check the level here before promising a write.

**Mistakes.** A URL-prefix identifier with the wrong scheme or subdomain, or missing its trailing slash, returns 403 "User does not have sufficient permission for site" even when the account is authorized — so copy `siteUrl` verbatim. This action takes no parameters.

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

## 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-sites",
  arguments: {},
})
```

**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-sites",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_search_console: { authProvisionId: "apn_xxxxxxx" },
  },
})

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-sites",
    "configured_props": {
      "google_search_console": { "authProvisionId": "apn_xxxxxxx" }
    }
  }'
```

---

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