describe_table
Retrieve table structure details including columns, data types, and constraints from Oracle databases to understand database schema organization.
Instructions
Get table structure including columns, data types, and constraints
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes | Table name | |
| schema | No | Schema name (optional, searches all accessible schemas if not specified) |
Implementation Reference
- src/index.js:381-418 (handler)The handler function that executes the describe_table tool. It constructs a SQL query against ALL_TAB_COLUMNS to retrieve column metadata for the specified table, optionally filtered by schema, and returns formatted JSON.async handleDescribeTable(args) { const query = ` SELECT owner AS schema_name, column_name, data_type, data_length, data_precision, data_scale, nullable, data_default, column_id FROM all_tab_columns WHERE table_name = :1 ${args.schema ? 'AND owner = :2' : ''} ORDER BY owner, column_id `; const params = [args.table_name.toUpperCase()]; if (args.schema) { params.push(args.schema.toUpperCase()); } const result = await this.executeQuery(query, params); return { content: [ { type: 'text', text: JSON.stringify({ table: args.table_name, schema: args.schema || 'all accessible schemas', columns: result.rows }, null, 2) } ] }; }
- src/index.js:214-227 (schema)Input schema definition for the describe_table tool, specifying table_name as required and schema as optional.inputSchema: { type: 'object', properties: { table_name: { type: 'string', description: 'Table name' }, schema: { type: 'string', description: 'Schema name (optional, searches all accessible schemas if not specified)' } }, required: ['table_name'] }
- src/index.js:211-228 (registration)Tool registration in the ListTools response, defining name, description, and input schema for describe_table.{ name: 'describe_table', description: 'Get table structure including columns, data types, and constraints', inputSchema: { type: 'object', properties: { table_name: { type: 'string', description: 'Table name' }, schema: { type: 'string', description: 'Schema name (optional, searches all accessible schemas if not specified)' } }, required: ['table_name'] } },
- src/index.js:288-289 (registration)Dispatch in CallToolRequest handler switch statement that routes describe_table calls to the handler function.case 'describe_table': return await this.handleDescribeTable(args);