Skip to main content
Glama

database_search

Read-only

Searches a table that has semantic search on and returns the best rows, whole, as JSON. Four stages run in one statement: an exact match on the primary key or a unique column is pinned first, keyword search and vector search each take their best 200, and the two lists are fused with reciprocal rank fusion (k=60) only after the candidates are joined back to the table under the Product's own role, so a row the role cannot see never moves the rank of one it can. With traverse, the top rows become seeds and their related rows come back too, scored lower with each hop. explain: true returns the compiled SQL, the count and time of every stage, and for each row why it came back. The query itself is embedded (a few tokens, billed at cost). Read-only.

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": {
      "productId": "<productId>",
      "databaseId": "<databaseId>",
      "table": "<table>",
      "query": "<query>"
    },
    "name": "database_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
kNoRows to return.
queryYesWhat to look for, in words. A primary key value or a unique value is matched exactly.
tableYesA table in the database, as schema.table or just table (public is assumed). It needs a single-column primary key.
whereNoEquality filters on columns of the table, e.g. {"scope_id": "prd_..."}. Applied in the same statement, under the same role, before ranking, so a filtered-out row cannot change the rank of one that is returned.
explainNoReturn the plan and per-row reasons as well as the rows.
traverseNoFollow relationships from the top seeds. Same limits as database_graph_traverse.
productIdYesProduct identifier, e.g. prd_7k2m9x4qw1nv8bz3ct6d.
databaseIdYesDatabase identifier, from product_get or database_get.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, yet the description adds substantial behavior beyond them: the four-stage fusion pipeline, RRF with k=60, and the crucial security property that candidates are joined under the Product's own role so invisible rows never affect ranking. It also discloses variable cost ('embedded, billed at cost') and what explain returns (compiled SQL, stage counts and timings, per-row reasons).

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?

The first sentence front-loads what the tool does and returns; subsequent sentences cover ranking, traversal, explain, cost, and safety in order of importance. The long pipeline sentence is dense but every clause carries distinct information, and nothing is redundant.

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?

For an eight-parameter tool with a nested traverse object and no output schema, the description covers return shape, ranking semantics, role-based visibility, traversal decay, and diagnostic output. The remaining details (k limits, depth/max_nodes caps) are fully documented in the schema.

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 100%, so the baseline is 3, but the prose adds real meaning: traverse turns top rows into seeds with scores decaying per hop, explain augments the response rather than replacing it, and the query string is embedded as tokens. The where filter's role in pre-ranking is also restated to explain why filtered rows cannot perturb ranks.

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 ('searches a table that has semantic search on') plus the return shape ('best rows, whole, as JSON'), and immediately decomposes the operation into its four ranking stages. An agent can tell this apart from database_query or database_execute without opening a schema.

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

Usage Guidelines4/5

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

Preconditions are stated up front: the table must have semantic search enabled, needs a single-column primary key, and the tool is read-only. The traverse and explain switches are explained in terms of when to use them (to pull related rows; to get the plan and per-row reasons). It does not explicitly name alternatives such as database_query for plain SQL or database_graph_traverse for pure graph walks, though the 'same limits as database_graph_traverse' reference implies the boundary.

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.

Resources