Skip to main content
Glama

search_collections

Search and retrieve geospatial data collections from STAC APIs to access satellite imagery, weather data, and other spatial-temporal assets.

Instructions

Return a page of STAC collections.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
catalog_urlNo

Implementation Reference

  • The core handler function that executes the search_collections tool logic: searches STAC collections using STACClient, handles JSON/text output formats, and formats results with titles, descriptions, and licenses.
    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)]
  • Registers the 'search_collections' tool with FastMCP server using @app.tool decorator, defines input parameters via type hints, and delegates execution to the internal execution module.
    @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, )
  • Internal registration mapping the 'search_collections' tool name to its handler function (handle_search_collections) in the tool execution dispatcher.
    _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, }
  • Import of the search_collections handler into the execution module.
    from stac_mcp.tools.search_collections import handle_search_collections

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BnJam/stac-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server