Skip to main content
Glama

Beancount.io

Run Beancount Query (BQL)

runBqlQuery
Read-onlyIdempotent

Execute a BQL (Beancount Query Language) query against the user's ledger and return results. BQL: SELECT cols [WHERE expr] [GROUP BY] [ORDER BY] [LIMIT n] | JOURNAL | BALANCES. Columns: date, year, month, flag, payee, narration, account, number, currency, cost, change, balance, position, tags, links, meta. An unaggregated query returns one row per posting, not per transaction, so LIMIT 5 can span 3 transactions; GROUP BY and DISTINCT return one row per group or value. LIMIT bounds the returned rows. Output past 1,000 lines or 100 KB is cut and ends with a truncation line; add LIMIT or a narrower WHERE to see the rest. The query travels in a POST body end to end, so long queries have no URL-length ceiling. Reference: https://beancount.github.io/docs/beancount_query_language/

Input Schema

NameRequiredDescriptionDefault
queryYesThe BQL query to execute
ledgerNoTarget ledger as owner/name. Required for an unpinned credential; defaults to the credential's ledger restriction.

Output Schema

NameRequiredDescriptionDefault
okYes
errorNo
resultNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent and non-destructive, and the description adds real behavioral context beyond them: truncation at 1,000 lines or 100 KB with a trailing truncation line, and the fact that long queries travel in a POST body with no URL-length ceiling. It omits what happens on an invalid query (error shape) and any ledger-permission/auth notes.

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 what the tool does, then progressively adds grammar, column vocabulary, row-granularity semantics, truncation limits, and the reference link. Each sentence carries distinct operational information; the column list is long but directly actionable for query construction.

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?

For a single free-form query tool with an output schema, the description covers grammar, supported columns, result granularity, and truncation, plus a canonical reference link. The remaining gap is the relationship to runBqlQueryStructured, which matters given how many sibling tools exist.

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%, so the schema already documents both `query` and `ledger`. The description adds grammar and column vocabulary for the query string but says nothing about the `ledger` parameter (owner/name format, defaults, pinned-credential behavior), so the appropriate baseline is 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — execute a BQL query against the user's ledger and return results — and immediately narrows scope with the supported statement/column grammar. It never names the sibling runBqlQueryStructured, so an agent cannot tell from the description alone which of the two to pick.

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

Usage Guidelines3/5

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

Usage is implied through the practical hint to 'add LIMIT or a narrower WHERE to see the rest' and through the row-granularity warning, which tells the agent how to shape a query for a desired result. But there is no explicit when-to-use guidance versus listLedgerEntries or runBqlQueryStructured, and no when-not guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.