---
title: MCP tools reference
description: Specification of the tools exposed by Queria's MCP server
---

The specification of the tools exposed by Queria's MCP server (`https://mcp.queria.io`; see [MCP server](/en/mcp)). The tools that read the catalog return results in a shared shape:

```json
{
  "columns": ["datasource", "title"],
  "rows": [["zipcode", "Zipcode"]],
  "truncated": false,
  "row_count": 1
}
```

When `truncated: true`, a `hint` field explains what to do. Besides a result cut for size, `search_catalog` also sets it when more matches remain beyond `limit`.

Tool calls are limited per minute. The limits are there to stop abuse and are wide enough that a normal conversation does not reach them.

| Caller | Limit (per minute) |
|---|---|
| Free account | 60 calls |
| Pro or organization plan | 300 calls |

When a limit is reached, the tool returns an error that says why and what to do next (wait a moment, or move to Pro).

## list_datasets

Returns all published datasets. Takes no arguments. Descriptions are cut to their first paragraph, at most 200 characters; `get_dataset` gives the full text with the source and license.

## search_catalog

| Argument | Type | Description |
|---|---|---|
| `keyword` | string (optional) | Substring-match keyword |
| `entry_type` | string (optional) | Filter by `dataset` / `table` / `column` |
| `limit` | int (default 50) | Maximum number of results |
| `columns` | string[] (optional) | Keep tables with a matching column for every condition |
| `keys` | string[] (optional) | Keep tables identified by one of these keys (`prefecture` / `city` / `small_area` / `town` / `mesh` / `corporate_number` / `postal_code`) |
| `geo` | bool (default false) | Keep tables with location data |
| `area` | string (optional) | Keep tables that cover this place, given as its local government code (6-digit `082201` with the check digit, 5-digit `08220`, or 2-digit `08` for a prefecture) |
| `year` | int (optional) | Keep tables whose period covers this year (`2020`) |
| `min_rows`, `max_rows` | int (optional) | Keep tables whose row count is in this range (both ends included) |
| `values` | string[] (optional) | For each condition, keep tables with a column holding a value that contains it (up to 8) |

Searches across datasets, tables, and columns. Datasets match on title and description; tables and columns match on name, title, description, and tags. `columns`, `keys` and `geo` mean the same as on [`queria search`](/en/reference/cli#queria-search); with any of them, `keyword` may be left out.

When `keyword` holds the name of a municipality or prefecture, nationwide tables that cover that place match too ([search by place name](/en/search#search-by-place-name)). The places found and their area codes come with the result as `places`.

The `period` column of the result holds each table's first and last period as `2015..2020` (`2020` for a single period, `2000-01-01..` when it has no end). The `keys` column lists the keys a table has (`prefecture` / `city` / `small_area` / `town` / `mesh` and so on), separated by commas, with `location` added when the table has latitude/longitude or GEOMETRY columns. Without opening the columns, it tells you whether a table goes down to town blocks and whether it can go on a map.

Like the other filters, `area`, `year`, `min_rows`, `max_rows` and `values` each let you leave out `keyword`. Without `keyword`, only tables are returned unless `entry_type` says otherwise.

Passing a local government code as `area` returns only the tables that cover that place, by the same rule as a place name. Use it to list the data available for a municipality or prefecture. The result's `places` holds the place for that code. An unknown code is an error.

Passing a year as `year` returns only the tables whose [period](/en/publish#period) covers it. Tables with no known period do not match.

`values`, `min_rows` and `max_rows` return only tables whose row count and value list are registered. `values` searches columns with up to 100 distinct values. The `rows` column of the result holds each table's row count (empty when not recorded).

## get_dataset

| Argument | Type | Description |
|---|---|---|
| `dataset` | string | Dataset name |

Returns the dataset's metadata (license, source URL, schema list, and so on) as `field` / `value` rows. Fields whose value is NULL are omitted.

## list_tables

| Argument | Type | Description |
|---|---|---|
| `dataset` | string | Dataset name |

Returns the dataset's tables and views (schema name, table name, description).

## list_columns

| Argument | Type | Description |
|---|---|---|
| `dataset` | string | Dataset name |
| `table` | string (optional) | Narrow down by table name |

Returns each column's name, type and description. With `table`, it also returns these values, measured on the dataset's current version:

- `table_rows`: the table's row count
- `null_count` and `distinct_count`: the number of NULL rows and of distinct values in the column
- `min` and `max`: the minimum and maximum of a numeric, date or time column
- `values`: every value of a column with at most 100 distinct values (age groups, years, prefectures and so on)

They are NULL for a table in a version that was not measured, for a large table with a geometry column, and for a premium dataset you cannot read.

## query

| Argument | Type | Description |
|---|---|---|
| `sql` | string | One DuckDB SELECT (or SUMMARIZE) statement |
| `datasets` | string[] (optional) | Datasets the SQL reads. When left out, they are taken from the `dataset.schema.table` references in the SQL. List one when the SQL does not name it in that form (a quoted name, for example) or to read another account's dataset of the same name (e.g. `["alice/sales"]`). Public datasets and private ones you can read, up to 10 |

Runs the SQL on Queria's server and returns the rows to the AI, without opening a view in the chat. It is for the AI to look at values, try joins and check its numbers. The final table, chart or map for the user is shown with `show_chart`.

- Tables are referenced as `<dataset>.<schema>.<table>`
- It returns the columns (name and type), up to the first 200 rows, whether they were cut (`truncated`), and the time taken. One run may take up to 50 seconds
- Runs count against the plan's weekly [usage allowance](/en/pricing#usage-allowance), and `show_chart` counts toward it too while you are signed in. When it runs out, the tool returns an error with the time it comes back; stop looking further and answer from what you have

## list_docs

Lists this documentation's pages. The way in to reading the docs without web access.

| Argument | Type | Description |
|---|---|---|
| `language` | string | `en` (default) or `ja` |
| `changelog` | bool (default false) | Also list the CLI's release notes (`changelog/<version>`) |

The `columns` are `name` / `section` / `title` / `description`. Pass a `name` straight to `read_doc`.

## read_doc

Returns one documentation page as Markdown.

| Argument | Type | Description |
|---|---|---|
| `name` | string | A page name from `list_docs` (e.g. `reference/cli`) |
| `language` | string | `en` (default) or `ja` |

Unlike the other tools, it answers with a document rather than a table:

```json
{
  "name": "reference/cli",
  "language": "en",
  "markdown": "---\ntitle: CLI reference\n---\n\n## Global options\n..."
}
```

## show_chart

| Argument | Type | Description |
|---|---|---|
| `sql` | string | One DuckDB SELECT statement |
| `description` | string | What the result shows, for a user who does not read SQL, in the user's language: the data, the conditions and how the numbers are counted. Shown at the top of the view in place of the SQL |
| `datasets` | string[] (optional) | Datasets the SQL reads. When left out, they are taken from the `dataset.schema.table` references in the SQL. List one when the SQL does not name it in that form (a quoted name, for example) or to read another account's dataset of the same name (e.g. `["alice/sales"]`). Private datasets only when `query` is available |
| `chart` | object (optional) | A chart: a Vega-Lite spec as in a [report](/en/reports)'s `chart` block, reading the result with `"data": {"name": "result"}` ([Draw charts and maps](/en/charts)) |
| `highlight` | (string \| number)[] (optional) | Values the chart emphasizes (e.g. `["世田谷区"]`): values on the x or y axis, or series of `encoding.color`. These are drawn purple and the rest gray. In a report, dashboard or map chart, write the same values in `usermeta.highlight` of the spec ([Highlight values](/en/charts#highlight-values)) |
| `map` | object (optional) | A map, written like a layer of a [report](/en/reports#put-sql-results-on-a-map)'s `type: map` (`area` + `code` or `lng` + `lat`, with `color`, `label`, `name`). The map takes the boundaries from shapes Queria prepares, so the SQL does not need them |
| `attempt` | integer (optional) | Leave out on the first call. When the view reports a failure, call again with the number it names |

It shows a view inside the chat (MCP Apps) with a table (first 200 rows) and a chart or map.

- "Data" in the view lists the tables the SQL reads; each one opens that table on its dataset page. The response to the AI carries the same page URLs to cite
- With `map`, the result is drawn on a map above the table (the same map as in reports). The AI also gets the way to keep the same map in a report (`sql id=` and a `map` block). With `chart` it also gets the same chart as a `chart` block
- Clients that cannot show the view display nothing. The AI writes the numbers out instead

While `query` is offered, the SQL runs on Queria's server and the rows also come back to the AI in the result (the map is drawn in your browser).

SQL that reads a private dataset runs only on Queria's server, never in your browser. When the result has more than 200 rows the view shows the first ones, and once the allowance is used up the call returns an error.

For SQL that reads only public data, once the `query` allowance is used up, the SQL runs in DuckDB inside your browser and the view sends the result back to the AI:

- On success, the view sends the row count, the column names and the first 20 rows (tab-separated) to the chat, and the AI reads them and continues. The message shows in the chat as if the user sent it
- When the SQL or the chart fails, the view sends the reason to the chat, and the AI fixes it and calls again with `attempt` raised by one. From `attempt` 3 on, the view does not send it automatically, only when the user presses the button in the view
- Each call adds a view, and the table takes a few seconds to appear. When several views are in one conversation, they run one at a time from the top
- When the view cannot send the result or the failure to the chat (the host refuses it, or does not answer within 10 seconds), it asks the user to send "continue" in the chat. The result is already in the AI's context, so one message lets the AI carry on

## create_report

| Argument | Type | Description |
|---|---|---|
| `doc` | object (optional) | The whole block document. `view` chooses how it is shown |
| `source` | string (optional) | A report as Markdown (with front matter), instead of `doc` |
| `slug` | string (optional) | Readable name for the public URL (only when `view` is `report`). A public report also opens at `queria.io/reports/<handle>/<slug>`. When left out, the report's ID is used |
| `owner` | string (optional) | Handle of the account to create it in (default: your own) |
| `visibility` | string (optional) | `private` (default) / `members` / `public`. `members` is only for organizations on the Team plan |

Creates a [report](/en/reports). Pass either `doc` or `source`. Only available on `https://mcp.queria.io`, where you sign in (so are `update_report`, `list_reports` and `delete_report`).

Write `doc` as `{"version": 2, "title", "view", "data": "latest", "blocks": [...]}`. `view` is how it is shown and cannot change after creation.

- `report`: a document read top to bottom. Blocks are text (`{"type": "text", "markdown"}`), a table of an SQL result (`{"type": "query", "sql"}` or `{"type": "query", "view"}`), a chart (`{"type": "query", "chart"}`), a map (`{"type": "map", "map"}`) and a filter input (`{"type": "input", "name"}`). A chart `chart` is a Vega-Lite spec whose `"data": {"name": "<name>"}` points to the result of an SQL in the same block's `queries` (`[{"name", "sql"}]`). `view` also names a query in the same block. Each block carries the named SQL it reads, so a block can be shown and shared on its own. A chart block has no `sql` or `view`. For the Markdown format, read `read_doc("reports")`
- `dashboard`: cards and charts on a 12-column grid. Each block has a position `place` (`x`, `y`, `w`, `h`) and must not overlap another. Blocks are text (`{"type": "text", "markdown"}`) and a table or chart of an SQL result (`{"type": "query", "sql", "chart"}`), where `"data": {"name": "result"}` in `chart` points to the SQL result. `params` are filters and `tabs` are tabs
- `map`: a map, with tables, charts and text listed under "Map info" on the left. Put one map block (`{"id", "type": "map", "map": {...}}`); `main` in the result of `get_report` is its `id`. In `map`, write the trade areas `around`, the layers `layers`, the view `lng`, `lat`, `zoom`, and `report`, the `id` of the trade area to summarize (default: the first). The other blocks are tables and charts (`{"id", "type": "query", "sql", "chart"}`) and text (`{"id", "type": "text", "markdown"}`), with no `place`. A map has no `description`, `params` or `tabs`
  - A trade area has `id`, `name`, `lng`, `lat` and `radius`. `radius` is a whole number of meters from 100 to 3000. For a travel-time area, give minutes in one of `walk` (5, 10, 15, 20), `bike` (5, 10, 15) or `car` (10, 15, 20, 30)
  - A layer has `id`, `name`, `sql` and the columns that place it. To shade by area code, give `area` (`prefecture` / `city` / `small_area`) and the area code column `code`; to draw points, give the longitude and latitude columns `lng` and `lat`
  - In SQL, `$area.<id>` stands for the trade area's longitude, latitude and radius. Travel-time areas cannot be referenced with `$area.<id>`

In every view, each block has an `id` (letters, digits, `_` or `-`, unique in the document). Plotly `plot` is not accepted.

The result includes `{"report", "view", "title", "visibility", "revision", "url", "blocks"}`. `report` is the value to pass to the other tools: `<handle>/<slug>` when `view` is `report`, and the ID for `dashboard` and `map`. `revision` is the revision number to pass to `update_report`. `blocks` lists the saved blocks (`id`, `type`, `title`, `hash`). `hash` is a hash of the block content to pass in `bases` of `update_report`. You can create a long document with only its first blocks and add the rest with `update_report`, one block per call. When `view` is `report`, the result also has `chart_results` (`saved` / `live`), which tells whether chart results are stored. A `saved` report shows stored results, and a `live` report runs its SQL each time it is opened. For a report that reads only public data, Queria makes the results about a minute after each save, and the report becomes `saved`. Until then, and for reports that read private datasets, it is `live`.

Only make it `public` when the user asks.

## update_report

| Argument | Type | Description |
|---|---|---|
| `report` | string | The `report` value from `list_reports` or `create_report` |
| `revision` | integer (optional) | The `revision` from your last read (or create or update). Required with any change to the document |
| `bases` | object (optional) | For each block you replace or delete, its `hash` from the same result, keyed by `id` |
| `blocks` | array (optional) | Blocks to replace or add |
| `remove` | string[] (optional) | `id`s of blocks to delete |
| `order` | string[] (optional) | Every block `id` in the new order |
| `title` | string (optional) | Title |
| `description` | string (optional) | Description (`report` and `dashboard`) |
| `params` | array (optional) | Every filter. Writing it replaces the current ones |
| `tabs` | array (optional) | Every tab (`dashboard` only). Writing it replaces the current ones |
| `datasets` | array (optional) | Every dataset alias used in SQL. Writing it replaces the current ones |
| `source` | string (optional) | New Markdown, in full (`report` only) |
| `visibility` | string (optional) | `private` / `members` / `public` |
| `slug` | string (optional) | New readable name for the public URL (`report` only). An empty string removes it |

Write only the arguments that change. `blocks` replaces the block with the same `id` and adds a block with a new `id` at the end. Write every field of a block you replace, including the ones that stay the same. Blocks take the same shape as described for each view in `create_report`. To change a map's trade areas, layers or view, rewrite the whole map block, including the trade areas and layers to keep. The result has the same shape as `create_report`: the saved blocks (`blocks`) and the new `revision`. Saving can renumber block `id`s, so use the `id`s and `revision` in the result for the next change. Read it with `get_report` when you need a block's content. `source` cannot be sent together with the block arguments. A report whose `doc` is `null` cannot be changed block by block; send the full text in `source`. With `bases`, the update goes through even if the screen or another AI changed other blocks after your last read, as long as the blocks you change are as you read them. If a block you change, the order or a document field such as the title changed, the update is refused. Without `bases`, any change after your last read refuses the update. When it is refused, read it again with `get_report` and resend.

## get_report

| Argument | Type | Description |
|---|---|---|
| `report` | string | The `report` value from `list_reports` or `create_report` |

Reads a report, dashboard or map as a block document (`doc`) with its revision (`revision`). The result has the same shape as `create_report`, plus `doc` and the hash of each block (`hashes`, the values to pass in `bases` of `update_report`). When `view` is `report`, it also returns the Markdown (`source`). Public ones can be read without a token.

## list_reports

| Argument | Type | Description |
|---|---|---|
| `view` | string (optional) | Narrow to `report` / `dashboard` / `map` |
| `owner` | string (optional) | Narrow to one account (yours or an organization's) by handle |
| `offset` | int (optional) | Where to continue. Pass `next_offset` from the previous result |

Returns the reports, dashboards and maps of the accounts you belong to (personal and organizations), most recently updated first (`report` / `view` / `title` / `visibility` / `updated_at` / `url`). Those with `view` `report` come 100 at a time; when more remain, the result has `next_offset`.

## delete_report

| Argument | Type | Description |
|---|---|---|
| `report` | string | The `report` value from `list_reports` or `create_report` |

Deletes a report, dashboard or map. This cannot be undone. Only use it when the user asks to delete it. The result is `{"report", "view", "deleted": true}`.

## search_reports

| Argument | Type | Description |
|---|---|---|
| `query` | string (optional) | Words to search for in the title, description, tags, datasets and author. Leave it out to list recommended reports |
| `sort` | string (optional) | `relevance` (default with `query`), `recommended` (default without), `stars`, `new` or `updated` |
| `page` | int (optional) | Page number; pass the `next_page` of the previous result |

Searches the public reports listed in the [showcase](https://queria.io/showcase), Queria's own articles included, and returns 20 at a time (`report` / `title` / `description` / `account` / `date` / `datasets` / `tags` / `stars` / `url`). `total_count` is the number of matches; when more remain, the result has `next_page`. Read a report you found with `get_report`.

## fork_report

| Argument | Type | Description |
|---|---|---|
| `report` | string | `<handle>/<slug>` of the public report to copy (the `report` of `search_reports`) |
| `owner` | string (optional) | Handle of the organization to put the copy in. Defaults to your personal account |
| `slug` | string (optional) | Readable name of the copy |
| `visibility` | string (optional) | `private` (default), `members` or `public` |

Copies a public report into a new report of your own. The SQL, charts and text are kept; the author becomes the account the copy belongs to and the date becomes today. Images are not copied. The copy is recorded as a fork of the original and is private by default. Change it afterwards with `update_report`. Returns `{"report", "title", "visibility", "revision", "url", "forked_from"}`.

## save_table

| Argument | Type | Description |
|---|---|---|
| `name` | string | Dataset name (lowercase letters, digits and `_`, starting with a letter, e.g. `my_shops`) |
| `csv` | string (optional) | The table as CSV with a header row. Column types are detected automatically |
| `sql` | string (optional) | One DuckDB SELECT whose result is saved. It runs on Queria's server like `query` and keeps the column types. Available only when `query` is offered |
| `datasets` | string[] (optional) | Datasets the `sql` reads, as in `query` |
| `title` | string (optional) | Title shown on Queria (up to 200 characters) |
| `description` | string (optional) | Description (up to 1,000 characters) |
| `owner` | string (optional) | Handle of the organization to save to. Left out: your personal account |
| `language` | string (optional) | Language of the title and description: `ja` (default) or `en` |

Pass exactly one of `csv` or `sql`. The table is saved to the private dataset `<owner>/<name>`, and the tool returns `{"dataset", "table", "version", "hint"}`. Read the saved table as `<name>.main.places` from `query`, `show_chart` and report SQL.

- One save holds up to 1,000 rows. A larger table is refused and nothing is saved
- Saving again under the same name adds a new version of the same dataset. Earlier versions are kept
- You cannot save under the name of a dataset that is not private (public or premium)
- GEOMETRY columns cannot be saved. Convert them to longitude and latitude with `ST_X` and `ST_Y`, or to text with `ST_AsText`
- Saving fails when it would exceed the storage limit for private datasets
- The tool is offered only on connections that can save datasets ([MCP server](/en/mcp), sign-in and permissions). It is not offered on connections an organization made read-only
- Use it only when the user asks to save data

## open_issue

| Argument | Type | Description |
|---|---|---|
| `dataset` | string | Dataset name (`e_stat`) or `handle/name` (`queria/e_stat`) |
| `title` | string | The title (up to 200 characters) |
| `body` | string | The description (up to 20,000 characters). Name the table and column, the value found, the value expected, and the SQL that shows it |
| `confirm_token` | string (optional) | Token for opening an issue from a draft the user approved |

Opens a public [issue](/en/exploring-datasets#create-an-issue) on a dataset for a problem in its data (a wrong, missing or stale value, a mismatch with the description) or a change request. Everyone who can read the dataset sees the issue, with the user's handle as its author.

**This tool never opens an issue without the user's approval.** The first call always returns `needs_approval` (a draft only).

| `status` | Meaning | What the agent should do |
|---|---|---|
| `needs_approval` | A draft was made (**not opened yet**) | Show `preview` to the user **in full, as is**; once they approve, call again with the same `dataset`, `title` and `body` plus `confirm_token` |
| `opened` | The issue was opened (includes `number` and `url`) | Give the user the `url` |

- `confirm_token` is a signature over the draft and is valid for an hour. Changing a single character of the title or description makes it fail
- When it cannot open the issue (a dataset you cannot read, an archived or frozen dataset, no handle yet, the limit of 10 a day), the tool returns an error with the reason
- The tool is offered only on connections signed in with a personal account that allow writes. Organization tokens, tokens issued without write access, and connections an organization made read-only do not get it

**Never put personal data or credentials in the text.** Anything that looks like a credential is not sent.

## submit_feedback

| Argument | Type | Description |
|---|---|---|
| `kind` | string | `dataset_request` / `docs_issue` / `cli_issue` / `other` |
| `message` | string | The text (up to 4000 characters) |
| `dataset` | string (optional) | The dataset it is about |
| `confirm_token` | string (optional) | Token for sending a draft the user approved |

Reports a dataset request, a documentation error, or a tool defect to Queria. Wrong data goes to the dataset's issues with [`open_issue`](#open_issue). Unlike the other tools, it returns `{"status": ...}`.

**This tool never sends without the user's approval.** The first call always returns `needs_approval` (a draft only).

| `status` | Meaning | What the agent should do |
|---|---|---|
| `needs_approval` | A draft was made (**not sent yet**) | Show `preview` to the user **in full, as is**; once they approve, call again with the same `kind`, `message` and `dataset` plus `confirm_token` |
| `sent` | Sent and stored (includes `id`) | Say so once, briefly |

- `confirm_token` is a signature over the draft and is valid for an hour. Changing a single character of the text makes it fail. Sending the same text twice stores it once
- When it cannot send (empty or too long, something that looks like a credential, a limit reached), the tool returns an error with the reason
- Up to 20 reports a day

**Never put query results, personal data or credentials in the text.** Anything that looks like a credential (strings starting with `qk_`, AWS keys and so on) is not sent.
