gsc_list_sites
List all Google Search Console properties accessible with your authentication, returning site URLs and permission levels to use with other tools.
Instructions
List every Google Search Console property the authenticated user can access.
Returns a table of site URLs and permission levels. Use the exact siteUrl string returned here when calling other tools — the format matters (domain properties use 'sc-domain:example.com' prefix).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- gsc_mcp/server.py:107-118 (handler)The main handler for the gsc_list_sites tool. Offloads the synchronous API call to a thread, then formats the results.
async def gsc_list_sites(params: ListSitesInput) -> str: """List every Google Search Console property the authenticated user can access. Returns a table of site URLs and permission levels. Use the exact siteUrl string returned here when calling other tools — the format matters (domain properties use 'sc-domain:example.com' prefix). """ try: sites = await asyncio.to_thread(api.list_sites) return format_sites(sites, params.response_format) except Exception as exc: return format_api_error(exc) - gsc_mcp/server.py:88-94 (schema)Pydantic input schema for gsc_list_sites, with an optional response_format field.
class ListSitesInput(BaseModel): model_config = ConfigDict(extra="forbid") response_format: ResponseFormat = Field( default=ResponseFormat.MARKDOWN, description="Output format: 'markdown' for a human-readable table, 'json' for raw data.", ) - gsc_mcp/server.py:97-106 (registration)Registration of gsc_list_sites as an MCP tool via the @mcp.tool decorator with metadata annotations.
@mcp.tool( name="gsc_list_sites", annotations={ "title": "List verified Search Console sites", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True, }, ) - gsc_mcp/api.py:52-55 (helper)The actual Google Search Console API call to list verified sites via the sites().list() endpoint.
def list_sites() -> list[dict[str, Any]]: """Return all Search Console properties the authenticated user owns.""" response = get_service().sites().list().execute() return response.get("siteEntry", []) - gsc_mcp/formatters.py:45-60 (helper)Formats the list of sites into either a Markdown table or JSON output.
def format_sites(sites: list[dict[str, Any]], fmt: ResponseFormat) -> str: if fmt == ResponseFormat.JSON: return json.dumps(sites, indent=2) if not sites: return "No verified sites found for the authenticated user." lines = [ f"Found {len(sites)} verified site(s):", "", "| Site URL | Permission Level |", "| --- | --- |", ] for s in sites: lines.append(f"| `{s.get('siteUrl', '')}` | {s.get('permissionLevel', '')} |") return "\n".join(lines)