search_collections
Discover and list available geospatial data collections from STAC catalogs to identify relevant satellite imagery, weather data, and other spatial datasets for analysis.
Instructions
Search and list available STAC collections
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog_url | No | STAC catalog URL (optional, defaults to Microsoft Planetary Computer) | |
| limit | No | Maximum number of collections to return |
Implementation Reference
- The handler function that implements the core logic of the search_collections tool, searching STAC collections and formatting results as text or JSON.def handle_search_collections( client: STACClient, arguments: dict[str, Any], ) -> list[TextContent] | dict[str, Any]: limit = arguments.get("limit", 10) collections = client.search_collections(limit=limit) if arguments.get("output_format") == "json": return { "type": "collection_list", "count": len(collections), "collections": collections, } result_text = f"Found {len(collections)} collections:\n\n" for collection in collections: title = collection.get("title") or collection.get("id", "Untitled collection") identifier = collection.get("id", "unknown") result_text += f"**{title}** (`{identifier}`)\n" description = collection.get("description") if description: desc = str(description) truncated = desc[:MAX_DESC_PREVIEW] ellipsis = "..." if len(desc) > MAX_DESC_PREVIEW else "" result_text += f" {truncated}{ellipsis}\n" license_value = collection.get("license", "unspecified") result_text += f" License: {license_value}\n\n" return [TextContent(type="text", text=result_text)]
- stac_mcp/tools/execution.py:56-67 (registration)Internal registry mapping tool names to their handler functions, including search_collections._TOOL_HANDLERS: dict[str, Handler] = { "search_collections": handle_search_collections, "get_collection": handle_get_collection, "search_items": handle_search_items, "get_item": handle_get_item, "estimate_data_size": handle_estimate_data_size, "get_root": handle_get_root, "get_conformance": handle_get_conformance, "get_queryables": handle_get_queryables, "get_aggregations": handle_get_aggregations, "sensor_registry_info": handle_sensor_registry_info, }
- stac_mcp/server.py:37-47 (registration)MCP server tool registration for search_collections, defining input parameters and proxying to execution.@app.tool async def search_collections( limit: int | None = 10, catalog_url: str | None = None ) -> list[dict[str, Any]]: """Return a page of STAC collections.""" return await execution.execute_tool( "search_collections", arguments={"limit": limit}, catalog_url=catalog_url, headers=None, )