Skip to main content
Glama
actual-mcp-server

actual-mcp-server

Run read-only budget query

run_query
Read-onlyIdempotent

Run read-only SQL queries against Actual Budget data when built-in search, summary, or list tools cannot express the filter or join you need.

Instructions

Run a read-only SQL query against the budget data; the escape hatch when search_transactions, summarize_transactions, list_entities and list_budget_months do not fit (prefer them when they do). Form: SELECT [fields] FROM [table] WHERE [conditions] ORDER BY [field] DESC LIMIT [n]. Example: "SELECT id, date, amount, payee.name FROM transactions WHERE amount < 0 ORDER BY date DESC LIMIT 10". WHERE supports =, !=, >, >=, <, <=; IN (v1, v2); LIKE / NOT LIKE (case and accent-insensitive, % wildcard, e.g. imported_payee LIKE '%amazon%'); IS NULL / IS NOT NULL; boolean columns as true / false (cleared = false, category.hidden = true); conditions joined with AND. OR, REGEXP, NOT IN and parenthesised groups are not supported and return an error (a query is never silently run unfiltered). Writes, stacked statements and comments are refused. Transactions come back in split-inline mode: "is_parent = true" returns nothing, use "is_parent = false" to exclude split children. Joins use dot notation: payee.name, category.name, account.name (NOT payee_name). Amounts are in cents: $100.00 = 10000. Dates are quoted YYYY-MM-DD strings: date >= '2025-01-01'. Returns { result: { data: rows, dependencies } }; an empty result may carry a "hint" naming a category.name, payee.name or account.name value that matches no entity, with the query that lists the exact names. Tables: transactions (id, date, amount, notes, cleared, account, payee, category); accounts (id, name, closed, offbudget, sort_order, account_group_id); categories (id, name, group, is_income, hidden); payees (id, name, transfer_acct); category_groups (id, name, is_income, hidden; rows carry nested categories); also schedules, rules, notes, preferences, account_groups. Select the fields you need: a bare table name returns only { id }. AS aliases are ignored.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "run_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe read-only SQL query to run, for example SELECT id, name FROM accounts.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.30.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already cover the read-only/idempotent/non-destructive profile, yet the description adds substantial behavior beyond them: unsupported clauses (OR, REGEXP, NOT IN, parentheses) return an error and never silently run unfiltered; writes, stacked statements and comments are refused; split-inline mode means is_parent = true returns nothing. These are exactly the failure modes an agent must anticipate.

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-loaded with purpose and routing, then dialect rules, then return shape and table inventory; nearly every sentence is load-bearing because the SQL dialect is non-standard. It is dense and the critical split-inline caveat sits mid-paragraph rather than being surfaced, which slightly hurts scannability.

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, so the description supplies the return envelope ({ result: { data, dependencies } }) and the empty-result hint behavior. It also enumerates the queryable tables and their columns, which an agent cannot infer from a one-parameter string schema.

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

Parameters5/5

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

With a single parameter at 100% schema coverage the baseline would be 3, but the description adds far more than the schema: accepted clause form, supported WHERE operators, case/accent-insensitive LIKE, boolean literal conventions, dot-notation joins, cents for amounts, and quoted YYYY-MM-DD dates. It also warns that a bare table returns only { id } and that AS aliases are ignored.

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 a read-only SQL query against the budget data") and immediately frames itself as the escape hatch relative to four named siblings. An agent can distinguish it from search_transactions or summarize_transactions without opening any schema.

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?

Explicitly gives both directions: use this when the named tools "do not fit," and "prefer them when they do." It names the concrete alternatives (search_transactions, summarize_transactions, list_entities, list_budget_months), leaving nothing to inference.

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