Skip to content

Converting natural language query to HTTP query #5

Description

@ColinMaudry

My main objective with using datagouv-mcp is to enable the querying of data served by the tabular-api using natural language.

The query_resource_data tool seems to almost do the job, after exclicitly telling it get the column names (1 row of results) in order to infer the mapping with the data mentioned in the the natural language query:

The column names are pretty excplicit, so retrieve the first row to discover the column names and infer the columns to use.

With this, it did indeed infer the right column names.


Me: Using this resource https://tabular-api.data.gouv.fr/api/resources/22847056-61df-452d-837d-8b8ceadbfc52/data/, assuming that one "marché" is a group of row with the same `uid` value, please return all marchés for which the titulaire is located in département 35 and for which the montant is above 1
  000 000 euros. Also, since I'm just testing, just return the first 3 rows.

Gemini: Okay, I understand. I will return the first 3 rows that directly meet your specified criteria: titulaire_departement_code is '35' and montant is greater than 1,000,000.

...
Question: Return the first 3 rows where titulaire_departement_code is '35' and montant is greater than 1000000.                                                                                                   │
...

[ 3 rows of unfiltered results, possibly the first 3 rows of the resource ]

My attempts to filter the data using query_resource_data via natural language questions have been unsuccessful; the tool is not accurately applying the specified conditions. To ensure precise filtering for
  titulaire_departement_code = '35' and montant > 1,000,000, I need to download and process the resource programmatically.

Before proceeding, I must confirm the resource size. May I use get_resource_info for resource ID 22847056-61df-452d-837d-8b8ceadbfc52?

Conclusion: the LLM seems to understand my query and the columns to filter on with a little help (use the column names), but falls short in using the tool to actually apply filters (use the HTTP parameters?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    3 - Low priorityNice-to-havefeatureNew MCP tools, prompts, resource types, or protocol capabilities

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions