datastore_search
Search and retrieve data from specified resources in the Datagov Israel MCP datastore, with options to filter, sort, and limit results for precise queries.
Instructions
Search a datastore resource.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| distinct | No | ||
| fields | No | ||
| include_total | No | ||
| limit | No | ||
| offset | No | ||
| plain | No | ||
| q | No | ||
| records_format | No | objects | |
| resource_id | Yes | ||
| sort | No |
Implementation Reference
- server.py:105-128 (handler)The handler function for the 'datastore_search' tool, decorated with @mcp.tool() for registration. It searches a datastore resource on Data.gov.il by making an API request with the provided parameters and returns the JSON response. The function signature defines the input schema.@mcp.tool() async def datastore_search(ctx: Context, resource_id: str, q: str = "", distinct: bool = False, plain: bool = True, limit: int = 100, offset: int = 0, fields: str = "", sort: str = "", include_total: bool = True, records_format: str = "objects"): """Search a datastore resource.""" await ctx.info(f"Searching datastore for resource: {resource_id}") params = { "resource_id": resource_id, "q": q, "distinct": distinct, "plain": plain, "limit": limit, "offset": offset, "fields": fields, "sort": sort, "include_total": include_total, "records_format": records_format } response = requests.get(f"{BASE_URL}/action/datastore_search", params=params) response.raise_for_status() return response.json()
- server.py:105-105 (registration)Registration of the datastore_search tool via the FastMCP @mcp.tool() decorator.@mcp.tool()
- server.py:106-110 (schema)Input schema defined by function parameters with types and defaults, and docstring description.async def datastore_search(ctx: Context, resource_id: str, q: str = "", distinct: bool = False, plain: bool = True, limit: int = 100, offset: int = 0, fields: str = "", sort: str = "", include_total: bool = True, records_format: str = "objects"):