Skip to main content
Glama
ckan-thaigdc-mcp

ckan-thaigdc-mcp

by nungsatick

Query CKAN Table

ckan_query_data
Read-onlyIdempotent

Query rows from CKAN resources with exact filters, full-text search, column selection, sorting, and distinct values; check the resource is queryable first.

Instructions

Read rows from a queryable resource, with filters, full-text search, column selection, sorting and distinct values. Only works where ckan_get_dataset shows the resource as queryable.

Call ckan_get_resource first for the column names: an unknown column is an error.

Examples:

  • Rows for one region -> filters={"region": "ภาคเหนือ"}

  • Several values -> filters={"region": ["ภาคเหนือ", "ภาคใต้"]}

  • Which regions exist -> fields=["region"], distinct=true

  • Highest values first -> sort="Per_HH_Tablet desc", limit=5

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "site": "<site>",
      "resource_id": "<resource_id>"
    },
    "name": "ckan_query_data"
  }
}

Input Schema

NameRequiredDescriptionDefault
qNoFull-text search across all columns
siteYesSite alias from ckan_list_sites, e.g. 'nso'
sortNoe.g. 'year desc, region'
limitNoRows to return. Fewer may come back if the response would be too long
fieldsNoColumns to return. Default: all
offsetNoRows to skip, for pagination
filtersNoExact matches by column; a list matches any of its values
distinctNoReturn only distinct rows; combine with fields
resource_idYesResource UUID
response_formatNo'markdown' for readable text, 'json' for structured datamarkdown

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint, so the safety profile is covered. The description adds value beyond them by disclosing the queryable-resource eligibility constraint and that unknown columns raise errors. It stops short of describing truncation or pagination behavior in prose, leaving that to the schema.

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

Conciseness5/5

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

Front-loaded with purpose and preconditions before the example block, and the examples are terse arrow-mapped intent-to-argument lines with zero filler. Every sentence either constrains eligibility, warns about an error case, or shows a call pattern.

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

Completeness5/5

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

For a 10-parameter tool with a nested filters object and no output schema, the description covers the two things the schema cannot: resource eligibility and the prerequisite column lookup that prevents errors. Output shape is addressed by the response_format enum in the schema, so no return-value prose is needed.

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?

Schema coverage is 100%, so the baseline is 3, but the examples add real meaning: the filters list semantics ("which regions exist" via fields + distinct), and sort syntax with a concrete "Per_HH_Tablet desc" value paired with a limit. The examples demonstrate combinations of distinct/fields/sort/limit that the schema documents individually but never composes.

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?

Opens with a specific verb and resource ("Read rows from a queryable resource") and enumerates the actual capabilities: filters, full-text search, column selection, sorting, distinct. It also distinguishes itself from siblings by scoping to resources that ckan_get_dataset marks as queryable, so an agent can tell it apart from metadata-fetching tools without opening a schema.

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

Usage Guidelines5/5

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

States a hard precondition ("Only works where ckan_get_dataset shows the resource as queryable") and a required prerequisite call to ckan_get_resource for column names, with the failure mode spelled out (unknown column is an error). The four worked examples map concrete intents to concrete argument shapes, which is stronger than generic when-to-use prose.

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