Skip to main content
Glama

Read from the workspace database

query_database
Read-only

Read workspace SQLite data with a single parameterized SELECT query. Runs read-only against the same database blocks use, so any statement that would change data is refused; use execute_sql for writes.

Instructions

Runs a READ against the workspace's own SQLite database — the same one blocks reach as db.query(...). The connection cannot write, so a statement that turns out to change something is refused rather than run; use execute_sql for that.

To see what exists: SELECT name FROM sqlite_master WHERE type = 'table' SELECT name, type, pk FROM pragma_table_info('tasks')

Note the second one: PRAGMA table_info(...) counts as a write on this connection, while the pragma_table_info(...) function is an ordinary read and answers the same question. Parameters are @name or :name — never concatenate a value into SQL.

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": {
      "workspaceId": "<workspaceId>",
      "sql": "<sql>"
    },
    "name": "query_database"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne statement, e.g. "SELECT * FROM tasks ORDER BY created DESC LIMIT 20".
paramsNoValues for the @name placeholders, e.g. { "id": 7 }.
workspaceIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.53.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true, and the description adds real substance the annotation cannot: the connection physically cannot write, mutating statements are refused rather than executed, and PRAGMA table_info is treated as a write while the pragma_table_info function is a read. It does not disclose the return shape (rows/columns) or limits on result size, which keeps it off a 5.

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 the core action and its read-only constraint, then the alternative, then the discovery examples, then the binding rule. Every sentence carries operational information; the example queries earn their space by preventing a breaking mistake.

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?

With no output schema, the description leaves the result format (rows, columns, error shape) unstated, and the required workspaceId is not described. Otherwise it is unusually complete for a three-parameter SQL tool: it covers read-only enforcement, dialect quirks, and parameterization.

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

Parameters4/5

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

Schema coverage is 67%; the description extends meaning beyond the schema by specifying that placeholders are @name or :name only and must never be string-concatenated into SQL, matching the params object's intent. The required workspaceId parameter is only implicitly covered by 'the workspace's own database' and gets no explicit explanation.

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 ('Runs a READ against the workspace's own SQLite database') and anchors it to a familiar equivalent ('the same one blocks reach as db.query(...)'), which immediately distinguishes it from write-oriented siblings like execute_sql.

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 routes the agent: reads belong here, statements that change something belong in execute_sql. It also supplies concrete discovery queries (sqlite_master, pragma_table_info) so the agent knows how to start rather than guessing at table names.

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