Skip to main content
Glama
ondata

CKAN MCP Server

by ondata

Search CKAN DataStore with SQL

ckan_datastore_search_sql
Read-onlyIdempotent

Run SQL SELECT queries on CKAN DataStore resources to filter, aggregate, and retrieve public open data.

Instructions

Run SQL queries on a CKAN DataStore resource.

This endpoint is only available on CKAN portals with DataStore enabled and SQL access exposed.

Args:

  • server_url (string): Base URL of CKAN server

  • sql (string): SQL query (e.g., SELECT * FROM "resource_id" LIMIT 10)

  • response_format ('markdown' | 'json'): Output format

Returns: SQL query results from DataStore

Examples:

  • { server_url: "...", sql: "SELECT * FROM "abc-123" LIMIT 10" }

  • { server_url: "...", sql: "SELECT COUNT(*) AS total FROM "abc-123"" }

Typical workflow: ckan_package_show (get resource_id) → ckan_datastore_search_sql (run SQL on it)

Security note: SQL queries are forwarded directly to the CKAN DataStore API. The CKAN server enforces its own access controls and read-only permissions. No local database is exposed. Queries are limited to public DataStore resources on the target portal.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL SELECT query; resource_id is the table name, must be double-quoted (e.g., SELECT * FROM "abc-123" LIMIT 10)
server_urlYesBase URL of the CKAN server (e.g., https://dati.gov.it/opendata)
response_formatNoOutput format: 'markdown' for human-readable or 'json' for machine-readablemarkdown
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate readOnlyHint=true and destructiveHint=false. The description adds context: SQL is forwarded to CKAN API, no local database exposure, CKAN enforces access controls. This adds value beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is structured with sections (Args, Returns, Examples, workflow, security) and is concise for the amount of information provided. No redundant sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite no output schema, description explains return value as 'SQL query results from DataStore'. Includes examples, workflow, and security note, making it complete for an agent to understand usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% coverage, so baseline is 3. Description adds examples with double-quoting for resource_id and explains response_format options, which adds meaning beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states 'Run SQL queries on a CKAN DataStore resource', specifying the verb and resource. It distinguishes from siblings like ckan_datastore_search (which likely performs simpler searches without SQL).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description mentions prerequisites (DataStore enabled, SQL access exposed) and provides a typical workflow (ckan_package_show → ckan_datastore_search_sql). It does not explicitly state when not to use or identify sibling alternatives, but the context is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ondata/ckan-mcp-server'

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