Skip to main content
Glama
AkshaySwami14

pg-schema-scout

search_schema

Read-onlyIdempotent

Find the database tables relevant to a natural language question, returning their DDL, columns, and foreign-key relationships so you can write joins without examining the entire schema.

Instructions

Find the tables relevant to a question and return their DDL.

Prefer this over trying to read the whole schema. The schema is far larger than the part of it any one question needs, and sending all of it costs context you will want for the answer. Pass the user's question in natural language, not a table name guess: this ranks on column names, types and the schema's own comments.

Returns the highest-scoring tables with their columns and keys, plus the foreign-key edges between the returned tables, which is what you need to write the joins.

On failure or a disappointing result:

  • If a table you know you need is missing from the results, call describe_table with its name. Retrieval ranks, and a needed table can fall below the cutoff; describe_table is the escape hatch and does not depend on the ranking.

  • If nothing looks relevant, re-ask with the domain words the user used (for example "reseller", "purchase order", "pay history") before widening limit. Raising limit costs tokens and rarely fixes a vocabulary mismatch.

  • Do not invent table names. If you cannot find it here, say so.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
questionYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteNoGuidance for the model, including what to do if the table it needs is absent.
tablesYes
backendYesRetrieval backend that ranked these tables: 'bm25' or 'titan'.
questionYes
tokenizerYesWhich tokenizer produced the counts.
foreign_keysNoForeign-key edges *between tables in this slice*, so joins can be written without fetching more schema.
estimated_tokensYesToken count of this slice's DDL, by the tokenizer named in tokenizer.
full_schema_tokensYesToken count of the entire schema's DDL, for comparison with estimated_tokens.
Behavior5/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false. The description adds valuable behavioral context beyond this: ranking based on column names/types/comments, returning highest-scoring tables with columns and keys, foreign-key edges between returned tables, and failure-mode behavior. This significantly enhances the agent's understanding of how the tool operates.

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 description is longer than average but well-structured and front-loaded with the core purpose. Every sentence serves a purpose: explaining the tool's behavior, providing usage context, or detailing failure handling. The bullet-point structure for failure cases improves scannability without redundancy.

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?

The description is complete for the tool's complexity. It covers the tool's output (highest-scoring tables, columns, keys, foreign-key edges), input semantics, usage strategy, failure handling, and cost considerations. The presence of an output schema reduces the need to describe return details, and the description goes beyond the minimum.

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?

Schema description coverage is 0%, so the description must carry the burden. It explains that 'question' should be natural language ('Pass the user's question in natural language, not a table name guess') and clarifies the 'limit' parameter's cost/benefit ('Raising limit costs tokens and rarely fixes a vocabulary mismatch'). This fully compensates for missing schema descriptions.

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?

The first sentence explicitly states the tool's purpose: 'Find the tables relevant to a question and return their DDL.' This uses a specific verb and resource, clearly distinguishing it from siblings like describe_table (which retrieves a single table) and run_query (which executes 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?

The description provides explicit usage guidance: 'Prefer this over trying to read the whole schema' and outlines specific fallback instructions, including when to call describe_table ('If a table you know you need is missing'), how to rephrase the question with domain words, and a caution against inventing table names. This creates a clear decision tree for when to use this tool vs alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AkshaySwami14/pg-schema-scout'

If you have feedback or need assistance with the MCP directory API, please join our Discord server