Skip to main content
Glama

Run a SQL query over the folder

folio_query
Read-onlyIdempotent

Run a read-only SQL SELECT across CSV, JSON, Parquet, SQLite, DuckDB files and Markdown documents exposed as tables, returning rows for counts, filters, joins, tasks, and links.

Instructions

Run one read-only DuckDB SELECT over the served folder's data files and its documents as tables, and return the rows. Use it for any question data answers - counts, filters, joins across CSV, JSON, Parquet, SQLite or DuckDB files - and for questions about documents as data: what links to a page (folio.links where target is its path), open tasks, documents of a kind by a field. To read what one reference written in a document shows, use folio_embed. Anything but one SELECT, a path outside the folder and a web address are refused; a query stops after 10 seconds. Answers {columns: [{name, type}], rows, total: the row count, absent when rows were cut, partial: true when rows were cut, files: the data files read}: rows stop at 5,000 or 16 MB, and a long cell is cut at 20,000 characters, fewer when there are more than 10 columns.

Input Schema

NameRequiredDescriptionDefault
sqlYesOne SELECT. A data file is a table named by its path in single quotes, relative to folder, from the served folder after a slash, or absolute under the served folder: 'data/daily.csv', 'archive.sqlite#readings', or 'queries/q.sql' for a query file's result; * and ** patterns read many files at once. Documents are folio.documents(path, filename: the name without its folder, title: the one h1 outside <details>, kind), folio.headings(path, line, level, text, anchor), folio.links(path, line, url, target, fragment, context), folio.tasks(path, line, done, text), folio.frontmatter(path, key, value), folio.tables(path, line, row, header, cells), and kind.<name>(path and a column per field the kind declares)
folderNoThe folder the query runs from, relative to the served folder or absolute under it, such as reports/; quoted paths resolve against it. Omit for the served folder

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, not open world), yet the description adds genuinely new constraints: only a single SELECT is accepted, paths outside the folder and web addresses are refused, and queries time out after 10 seconds. It also discloses result truncation rules (5,000 rows or 16 MB, cells cut at 20,000 characters), which no annotation provides.

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?

Front-loads purpose and the sibling alternative before the constraints, and nearly every clause carries actionable information. The final sentence packs row limits, size cap and cell truncation into one dense run-on, which costs a point on readability.

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?

There is no output schema, and the description compensates fully by describing the return shape: columns with name/type, rows, total omitted when cut, partial flag, and files read. Combined with the refusal rules and timeout, an agent knows both how to call it and what to expect back.

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

Parameters3/5

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

Schema description coverage is 100% and the sql/folder descriptions already document path resolution, * and ** patterns, sqlite#table syntax, and the folio.* document tables. The prose in the description restates the same catalog rather than adding syntax or format meaning the schema lacks, so the baseline 3 is appropriate.

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?

States a specific verb and resource (run one read-only DuckDB SELECT over the folder's files and documents) and names the exact surface queried. It distinguishes itself from folio_embed explicitly, so an agent can tell which sibling handles reference resolution.

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?

Gives explicit when-to-use cases (counts, filters, joins across CSV/JSON/Parquet/SQLite/DuckDB; document questions via folio.links, folio.tasks, kind tables) and an explicit when-not with the alternative: use folio_embed to read what a reference shows. That is the routing decision an agent needs.

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