describe_table
Retrieve detailed table structure, including column names, data types, and constraints, from Oracle databases using schema-specific or global searches.
Instructions
Get table structure including columns, data types, and constraints
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | Schema name (optional, searches all accessible schemas if not specified) | |
| table_name | Yes | Table name |
Implementation Reference
- src/index.js:381-418 (handler)The handler function for describe_table tool. Queries Oracle's all_tab_columns view to fetch table columns, data types, lengths, precision, scale, nullability, defaults, and orders them by column_id. Returns formatted JSON with table info and columns.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 string and optional schema string.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)Switch case registration that dispatches describe_table tool calls to the handleDescribeTable method.case 'describe_table': return await this.handleDescribeTable(args);
- 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'] } },