Skip to main content
Glama
samscarrow

Oracle MCP Server

by samscarrow

get_table_indexes

Retrieve indexes for a specified table in Oracle databases. Input the table name and optional schema to identify and analyze relevant indexes for database optimization and query performance.

Instructions

Get indexes for a specific table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaNoSchema name (optional, searches all accessible schemas if not specified)
table_nameYesTable name

Implementation Reference

  • The handler function that implements the get_table_indexes tool. It constructs a SQL query to fetch index details from Oracle's ALL_INDEXES and ALL_IND_COLUMNS views, binds parameters for table_name and optional schema, executes the query, and returns the results as JSON.
    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:229-246 (registration)
    Tool registration in the ListTools response, including name, description, and input schema definition.
    { 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'] } },
  • Input schema definition for the get_table_indexes tool, specifying required table_name and optional schema parameters.
    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'] }
  • src/index.js:291-292 (registration)
    Dispatch case in the CallToolRequest handler that routes calls to the get_table_indexes tool to its handler function.
    case 'get_table_indexes': return await this.handleGetTableIndexes(args);

Other Tools

Related 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/samscarrow/oracle-mcp-server'

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