Skip to main content
Glama
Hug0x0

mcp-reunion

reunion_query_dataset

Retrieve records from any dataset on La Réunion open data portal using ODSQL queries with filters, sorting, and field selection. Access data by specifying a dataset ID and optional where clause.

Instructions

Generic escape hatch: fetch records from ANY data.regionreunion.com dataset with a raw ODSQL where clause. Call reunion_inspect_dataset first to know the fields. ODSQL supports operators like =, !=, >, <, LIKE, AND, OR, and the search() function.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataset_idYesDataset identifier
whereNoODSQL where clause, e.g. "commune = 'Saint-Denis' AND annee > 2020"
selectNoComma-separated list of fields to return (defaults to all)
order_byNoODSQL order_by clause, e.g. "date DESC"
limitNo

Implementation Reference

  • MCP tool handler for 'reunion_query_dataset' - fetches records from any data.regionreunion.com dataset with a raw ODSQL where clause via the ReunionClient.getRecords() method. Returns total_count + results as JSON.
    server.tool(
      'reunion_query_dataset',
      'Generic escape hatch: fetch records from ANY data.regionreunion.com dataset with a raw ODSQL where clause. Call reunion_inspect_dataset first to know the fields. ODSQL supports operators like =, !=, >, <, LIKE, AND, OR, and the search() function.',
      {
        dataset_id: z.string().describe('Dataset identifier'),
        where: z.string().optional().describe('ODSQL where clause, e.g. "commune = \'Saint-Denis\' AND annee > 2020"'),
        select: z.string().optional().describe('Comma-separated list of fields to return (defaults to all)'),
        order_by: z.string().optional().describe('ODSQL order_by clause, e.g. "date DESC"'),
        limit: z.number().int().min(1).max(100).default(20),
      },
      async ({ dataset_id, where, select, order_by, limit }) => {
        try {
          const data = await client.getRecords<RecordObject>(dataset_id, {
            where,
            select,
            order_by,
            limit,
          });
          return jsonResult({ total_count: data.total_count, results: data.results });
        } catch (error) {
          return errorResult(error instanceof Error ? error.message : 'Failed to query dataset');
        }
      }
    );
  • Zod schema for 'reunion_query_dataset' inputs: dataset_id (required string), where (optional ODSQL string), select (optional field list), order_by (optional ODSQL order), limit (1-100, default 20).
    {
      dataset_id: z.string().describe('Dataset identifier'),
      where: z.string().optional().describe('ODSQL where clause, e.g. "commune = \'Saint-Denis\' AND annee > 2020"'),
      select: z.string().optional().describe('Comma-separated list of fields to return (defaults to all)'),
      order_by: z.string().optional().describe('ODSQL order_by clause, e.g. "date DESC"'),
      limit: z.number().int().min(1).max(100).default(20),
    },
  • Registered via server.tool('reunion_query_dataset', ...) inside registerCatalogTools() at line 9-108 of src/modules/catalog.ts. registerCatalogTools is called from src/modules/index.ts line 35.
    server.tool(
      'reunion_query_dataset',
      'Generic escape hatch: fetch records from ANY data.regionreunion.com dataset with a raw ODSQL where clause. Call reunion_inspect_dataset first to know the fields. ODSQL supports operators like =, !=, >, <, LIKE, AND, OR, and the search() function.',
      {
        dataset_id: z.string().describe('Dataset identifier'),
        where: z.string().optional().describe('ODSQL where clause, e.g. "commune = \'Saint-Denis\' AND annee > 2020"'),
        select: z.string().optional().describe('Comma-separated list of fields to return (defaults to all)'),
        order_by: z.string().optional().describe('ODSQL order_by clause, e.g. "date DESC"'),
        limit: z.number().int().min(1).max(100).default(20),
      },
      async ({ dataset_id, where, select, order_by, limit }) => {
        try {
          const data = await client.getRecords<RecordObject>(dataset_id, {
            where,
            select,
            order_by,
            limit,
          });
          return jsonResult({ total_count: data.total_count, results: data.results });
        } catch (error) {
          return errorResult(error instanceof Error ? error.message : 'Failed to query dataset');
        }
      }
    );
  • ReunionClient.getRecords() - the HTTP method invoked by the handler to fetch dataset records from the OpenDataSoft API (data.regionreunion.com). Handles caching for referential datasets.
    async getRecords<T extends RecordObject = RecordObject>(
      datasetId: string,
      params: ODSQueryParams = {}
    ): Promise<ODSResponse<T>> {
      const url = this.buildUrl(`/catalog/datasets/${datasetId}/records`, params);
    
      if (REFERENTIAL_DATASETS.has(datasetId)) {
        const now = Date.now();
        const cached = this.recordsCache.get(url);
        if (cached && cached.expiresAt > now) {
          return cached.value as ODSResponse<T>;
        }
        const value = await this.fetchJson<ODSResponse<T>>(url);
        this.recordsCache.set(url, { value, expiresAt: now + REFERENTIAL_TTL_MS });
        return value;
      }
    
      return this.fetchJson<ODSResponse<T>>(url);
    }
  • buildWhere() helper used by the handler to construct ODSQL WHERE clauses; jsonResult/errorResult helpers for formatting tool responses.
    export function buildWhere(
      conditions: Array<string | undefined | null | false>
    ): string | undefined {
      const valid = conditions.filter((condition): condition is string => Boolean(condition));
      return valid.length > 0 ? valid.join(' AND ') : undefined;
    }
Behavior3/5

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

No annotations are provided, so the description must cover behavioral traits. It states the tool fetches records (a read operation) and mentions ODSQL operators, but does not disclose potential issues like performance, authentication, or error handling. The description adds value by naming ODSQL, but the schema already describes the where clause format.

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?

The description is only three sentences, each serving a distinct purpose: stating the tool's function, providing a prerequisite, and listing supported operators. No unnecessary words or redundancies.

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?

Given there is no output schema and no annotations, the description covers the essential aspects: what the tool does, its parameters (via schema), and a prerequisite. It could mention that the where clause must be valid ODSQL and that errors may occur for invalid syntax, but overall it is well-rounded. The presence of many sibling tools reduces the need for exhaustive detail.

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?

With 80% schema description coverage, the description adds meaning by explaining that dataset_id refers to any dataset from data.regionreunion.com, and it provides context for the where clause by listing supported ODSQL operators. This goes beyond the schema's terse descriptions, especially for dataset_id.

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?

The description clearly states it is a generic escape hatch to fetch records from any dataset with a raw ODSQL where clause. The name 'reunion_query_dataset' combined with the description distinguishes it from the many specialized sibling tools, as it is the only generic query tool.

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?

The description advises calling reunion_inspect_dataset first to know available fields, providing a clear prerequisite. The phrase 'generic escape hatch' implicitly suggests it should be used when a dedicated tool is not available, but it lacks explicit guidance on when not to use it or when to prefer a specific sibling tool.

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/Hug0x0/mcp-reunion'

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