Skip to main content
Glama
tannerpace

Oracle Database MCP Server

get_database_schema

Retrieve Oracle database schema details, including table lists or specific column information for query planning and data analysis.

Instructions

Get database schema information. If tableName is provided, returns column details for that table. Otherwise, returns a list of all accessible tables.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNameNoOptional table name to get column information for

Implementation Reference

  • Main handler function that executes the core logic for the 'get_database_schema' tool: input validation, schema retrieval, error handling, and response formatting.
    export async function getDatabaseSchema(input: GetSchemaInput = {}) {
      try {
        const validated = GetSchemaSchema.parse(input);
    
        logger.info('Getting database schema via MCP tool', {
          tableName: validated.tableName || 'all tables',
        });
    
        const result = await getSchema(validated.tableName);
    
        return {
          success: true,
          data: result,
        };
      } catch (err: any) {
        logger.error('Get schema tool failed', { error: err.message });
    
        return {
          success: false,
          error: err.message || 'Unknown error occurred',
        };
      }
  • Zod input schema for validating parameters of the 'get_database_schema' tool (optional tableName).
    export const GetSchemaSchema = z.object({
      tableName: z.string().optional(),
    });
  • src/server.ts:61-74 (registration)
    Tool registration in MCP server's tools list, defining name, description, and input schema.
    {
      name: 'get_database_schema',
      description:
        'Get database schema information. If tableName is provided, returns column details for that table. Otherwise, returns a list of all accessible tables.',
      inputSchema: {
        type: 'object',
        properties: {
          tableName: {
            type: 'string',
            description: 'Optional table name to get column information for',
          },
        },
      },
    },
  • MCP server dispatch handler for 'get_database_schema' tool calls: validates arguments, invokes the tool handler, and formats MCP response.
    } else if (name === 'get_database_schema') {
      const validated = GetSchemaSchema.parse(args || {});
      const result = await getDatabaseSchema(validated);
    
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
  • Supporting database function that generates and executes SQL queries for table lists or column schemas, used by the main tool handler.
    export async function getSchema(tableName?: string): Promise<any> {
      let query: string;
    
      if (tableName) {
        // Get columns for specific table
        query = `
          SELECT 
            column_name,
            data_type,
            data_length,
            nullable
          FROM user_tab_columns
          WHERE table_name = UPPER('${tableName}')
          ORDER BY column_id
        `;
      } else {
        // Get all accessible tables
        query = `
          SELECT 
            table_name,
            tablespace_name
          FROM user_tables
          ORDER BY table_name
        `;
      }
    
      return executeQuery(query, { maxRows: 1000 });
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the tool's conditional behavior based on the tableName parameter, which is useful context. However, it doesn't disclose important behavioral traits like whether this requires specific permissions, what 'accessible tables' means in terms of access control, error handling for invalid table names, or response format details.

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 perfectly concise with two sentences that efficiently convey all necessary information. The first sentence states the core purpose, and the second explains the conditional behavior. Every word earns its place with zero waste or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only schema inspection tool with no annotations and no output schema, the description provides adequate basic information about what the tool does and how parameters affect behavior. However, it lacks details about return format, error conditions, access restrictions, or what 'accessible tables' encompasses, which would be helpful given the absence of structured metadata.

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?

The input schema has 100% description coverage, with the tableName parameter clearly documented as optional. The description adds value by explaining the semantic impact of providing vs. not providing this parameter: it changes the return type from column details to a table list. However, it doesn't add syntax or format details beyond what the schema provides, meeting the baseline for high schema coverage.

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 description clearly states the verb 'Get' and resource 'database schema information', with specific conditional behavior: returns column details for a specific table if tableName is provided, otherwise returns a list of all accessible tables. This distinguishes it from the sibling tool 'query_database', which presumably executes queries rather than retrieving schema metadata.

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 description provides clear context on when to use the tool: use with tableName parameter to get column details for that table, or without parameter to get a list of all tables. However, it doesn't explicitly state when NOT to use it or mention alternatives like the sibling 'query_database' tool, which could be relevant for schema exploration vs. data querying.

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/tannerpace/mcp-oracle-database'

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