Skip to main content
Glama
git-scarrow

Oracle MCP Server

by git-scarrow

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
NameRequiredDescriptionDefault
table_nameYesTable name
schemaNoSchema name (optional, searches all accessible schemas if not specified)

Implementation Reference

  • 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)
          }
        ]
      };
    }
  • 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']
      }
    },

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/git-scarrow/oracle-mcp-server'

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