datastore_search
Search Israeli government datasets by resource ID to find specific records, filter results, and retrieve structured data from Data.gov.il.
Instructions
Search a datastore resource.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource_id | Yes | ||
| q | No | ||
| distinct | No | ||
| plain | No | ||
| limit | No | ||
| offset | No | ||
| fields | No | ||
| sort | No | ||
| include_total | No | ||
| records_format | No | objects |
Implementation Reference
- server.py:105-105 (registration)Registers the datastore_search function as an MCP tool using the @mcp.tool() decorator.@mcp.tool()
- server.py:106-127 (handler)The handler function that implements the datastore_search tool logic: constructs query parameters from inputs and performs HTTP GET to the backend datastore_search endpoint, returning the JSON response.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:106-110 (schema)Input schema defined by function signature type hints and default values, plus docstring description for the datastore_search 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"):