get_table_indexes
Retrieve index information for Oracle database tables to analyze query performance and optimize database structure.
Instructions
Get indexes for a specific table
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:420-453 (handler)The handler function that queries Oracle's ALL_INDEXES and ALL_IND_COLUMNS views to retrieve index information for the specified table, including schema if provided.async handleGetTableIndexes(args) { const query = ` SELECT i.owner AS schema_name, i.index_name, i.index_type, i.uniqueness, i.status, i.tablespace_name, LISTAGG(ic.column_name, ', ') WITHIN GROUP (ORDER BY ic.column_position) AS columns FROM all_indexes i JOIN all_ind_columns ic ON i.index_name = ic.index_name AND i.owner = ic.index_owner WHERE i.table_name = :1 ${args.schema ? 'AND i.owner = :2' : ''} GROUP BY i.owner, i.index_name, i.index_type, i.uniqueness, i.status, i.tablespace_name ORDER BY i.owner, i.index_name `; 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(result.rows, null, 2) } ] }; }
- src/index.js:232-245 (schema)Input schema defining parameters for the get_table_indexes tool: table_name (required) and optional schema.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:229-246 (registration)Tool registration in the list of available tools returned by ListToolsRequestHandler.{ name: 'get_table_indexes', description: 'Get indexes for a specific table', 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'] } },