package_search
Search datasets on Data.gov.il using query terms, filters, and sorting options. Retrieve relevant packages quickly with customizable row limits and include private data if needed.
Instructions
Find packages (datasets) matching query terms.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fq | No | ||
| include_private | No | ||
| q | No | ||
| rows | No | ||
| sort | No | ||
| start | No |
Implementation Reference
- server.py:39-56 (handler)The handler function for the 'package_search' tool. It is registered via @mcp.tool() decorator, defines input parameters serving as schema, and implements the logic by sending a GET request to the Data.gov.il CKAN API's package_search endpoint with the provided parameters and returns the JSON response.@mcp.tool() async def package_search(ctx: Context, q: str = "", fq: str = "", sort: str = "", rows: int = 20, start: int = 0, include_private: bool = False): """Find packages (datasets) matching query terms.""" await ctx.info("Searching for packages...") params = { "q": q, "fq": fq, "sort": sort, "rows": rows, "start": start, "include_private": include_private } response = requests.get(f"{BASE_URL}/action/package_search", params=params) response.raise_for_status() return response.json()
- server.py:39-39 (registration)The @mcp.tool() decorator registers the package_search function as an MCP tool.@mcp.tool()
- server.py:40-42 (schema)Input schema inferred from function signature parameters: q (query string), fq (filter query), sort, rows (default 20), start (default 0), include_private (default False). Output is the JSON response from the API.async def package_search(ctx: Context, q: str = "", fq: str = "", sort: str = "", rows: int = 20, start: int = 0, include_private: bool = False):