Skip to main content
Glama

get_ddl

Return the DDL definition of an Oracle object as a CLOB string without executing it. Specify the object name and type (and schema when needed) to retrieve creation SQL.

Instructions

Return the DDL definition of an object as a CLOB string, using DBMS_METADATA.GET_DDL. Read-only: never executes the DDL. All three parameters (schema, name, type) are REQUIRED. Valid type values: TABLE, VIEW, INDEX, SEQUENCE, PROCEDURE, FUNCTION, PACKAGE, PACKAGE BODY, TRIGGER, TYPE, SYNONYM, DB LINK. schema/name/type are matched case-insensitively against ALL_OBJECTS (lowercase is fine) and the exact stored object is passed to GET_DDL, so a case mismatch never surfaces as ORA-31603. Requires SELECT_CATALOG_ROLE plus EXECUTE on SYS.DBMS_METADATA (granted in db/setup_least_privilege_user.sql); privilege or not-found failures surface as error results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesObject name.
typeYesObject type, e.g. 'TABLE', 'VIEW', 'INDEX', 'PROCEDURE', 'FUNCTION', 'PACKAGE', 'SEQUENCE', 'TRIGGER'.
schemaNoSchema (owner) of the object. Optional — defaults to the server's current schema; omit rather than guess.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.16.3

TDQS

A4.1/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it declares read-only behavior, that the DDL is never executed, the required grants (SELECT_CATALOG_ROLE plus EXECUTE on SYS.DBMS_METADATA), and how privilege/not-found failures surface. This is exactly the behavioral context an agent needs before calling a DDL tool.

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?

Dense but front-loaded: purpose first, then safety, then parameters, then privileges/errors. Every sentence carries useful information, though the packing makes it read more like a spec than a description.

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?

No output schema and no annotations, yet the description covers return type (CLOB string), safety, prerequisites, and failure modes — everything needed to call it correctly. The one gap is the required/optional contradiction with the schema, which should have been aligned.

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 coverage is 100%, so the baseline is 3, and the description adds real value with the full list of valid type values (absent from the schema) and case-insensitive matching semantics. However, it claims 'All three parameters (schema, name, type) are REQUIRED' while the schema marks only name and type as required and explicitly calls schema optional/defaulting to the current schema — a direct conflict that undercuts the otherwise useful guidance.

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 ('Return the DDL definition of an object') and names the underlying mechanism (DBMS_METADATA.GET_DDL). An agent can immediately distinguish this object-level DDL extraction tool from the many list_* siblings.

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

Usage Guidelines3/5

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

Provides strong operational context (read-only, required privileges, error behavior) but never explicitly states when to choose this over alternatives like describe_table or search_objects. Usage is implied rather than routed.

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