Skip to main content
Glama
db-conn-mcp

db-conn-mcp

get_object_definition

Retrieve database-generated SQL definitions for non-table objects—views, functions, triggers, sequences, or indexes—by name, including schema-qualified and overloaded matches.

Instructions

Get the faithful SQL definition of a non-table object by name.

Covers views (and materialized views), functions/procedures, triggers, sequences, and indexes — produced by the database's own pg_get_*def functions. name may be schema-qualified ("public.my_view"); all matches are returned (same name in several schemas, overloaded functions).

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": {
      "database": "<database>",
      "object_type": "<object_type>",
      "name": "<name>"
    },
    "name": "get_object_definition"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYes
databaseYes
object_typeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does disclose meaningful behavior: output is produced by the database's own pg_get_*def functions (so it is faithful, not reconstructed), and multiple rows can come back for the same name across schemas or overloaded functions. It does not state read-only-ness explicitly, nor what happens when nothing matches, nor any permission requirements.

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 verb and resource, then scope, then naming rules — three short blocks with no filler. Every sentence adds information an agent would otherwise have to guess.

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 three-required-param tool with no output schema and no annotations, the definition covers what the return value conceptually is (faithful DDL text, possibly multiple matches) and how to target the object. The remaining gap is the undocumented `database` parameter and the not-found behavior, which are minor but real for a required field.

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 0%, so the description must compensate. It does well on `name` (schema-qualified form, multi-match semantics) and implicitly on `object_type` by listing the covered kinds that map to the enum values. The `database` parameter is never mentioned at all, leaving one of three required params undocumented in both layers.

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 ("Get the faithful SQL definition of a non-table object by name") and then enumerates exactly which object kinds are covered: views/materialized views, functions/procedures, triggers, sequences, indexes. The "non-table" qualifier plus the enumeration cleanly separates it from the sibling get_table_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?

The scope statement implicitly routes the agent: tables are excluded, so table DDL belongs to get_table_schema. It also explains the schema-qualification idiom ("public.my_view") and what happens without it, which is a real usage decision. It stops short of naming sibling alternatives explicitly or stating when-not to use it.

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