get_sift
Access the metadata and inferred extraction schema for a sift, revealing the typed fields and structure for querying document records as a database.
Instructions
Get sift metadata and inferred extraction schema for a specific sift.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sift_id | Yes |
Implementation Reference
- code/mcp/sifter_mcp/server.py:64-69 (handler)MCP tool handler for get_sift. Decorated with @mcp.tool(), this async function takes a sift_id, creates an AsyncSifter client, fetches the sift handle via the SDK, and returns its metadata dict.
@mcp.tool() async def get_sift(sift_id: str) -> dict: """Get sift metadata and inferred extraction schema for a specific sift.""" async with _get_client() as client: handle = await client.get_sift(sift_id) return handle._data if hasattr(handle, "_data") else {"sift_id": sift_id} - code/mcp/sifter_mcp/server.py:41-41 (registration)The get_sift function is registered implicitly via the @mcp.tool() decorator on a FastMCP instance named 'sifter'. This line creates that FastMCP instance.
mcp = FastMCP("sifter", streamable_http_path="/", stateless_http=True, transport_security=_transport_security) - code/mcp/sifter_mcp/server.py:44-48 (helper)Helper function that creates an AsyncSifter client instance, used by get_sift and all other tool handlers.
def _get_client() -> AsyncSifter: api_key = _request_api_key.get() or _env_api_key if not api_key: raise RuntimeError("SIFTER_API_KEY environment variable is required") return AsyncSifter(api_url=_api_url, api_key=api_key) - SDK-level async get_sift method on AsyncSifter class. Makes an HTTP GET request to /api/sifts/{sift_id} and wraps the response in an AsyncSiftHandle.
async def get_sift(self, sift_id: str) -> AsyncSiftHandle: async with httpx.AsyncClient() as http: r = await http.get( f"{self.api_url}/api/sifts/{sift_id}", headers=self._auth_headers(), ) r.raise_for_status() return AsyncSiftHandle(r.json(), self) - code/mcp/sifter_mcp/server.py:64-66 (schema)Type signature acts as schema — takes sift_id (str), returns a dict. No explicit Pydantic model; FastMCP derives from the type hints.
@mcp.tool() async def get_sift(sift_id: str) -> dict: """Get sift metadata and inferred extraction schema for a specific sift."""