Skip to main content
Glama
ajkeast

My Coding Buddy MCP Server

by ajkeast

get_table_indexes

Retrieve index metadata for a specific database table by providing its name. Returns details on existing indexes to aid in database analysis and optimization.

Instructions

Get index information for a specific table.

Args: table_name (str): Table name to inspect

Returns: str: Index metadata for the table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_table_indexes' tool. It takes a table_name, connects to the MySQL database via the get_connection() context manager, executes 'SHOW INDEX FROM `{table_name}`', and returns formatted index metadata (Key_name, Column_name, Seq_in_index, Unique, Index_type).
    def get_table_indexes(self, table_name: str) -> str:
        """Get index information for a specific table.
        
        Args:
            table_name (str): Table name to inspect
        
        Returns:
            str: Index metadata for the table
        """
        with self.get_connection() as conn:
            cursor = conn.cursor(dictionary=True, buffered=True)
            cursor.execute(f"SHOW INDEX FROM `{table_name}`")
            indexes = cursor.fetchall()
    
            if not indexes:
                return f"No indexes found for table '{table_name}'"
    
            output = [f"Indexes for table '{table_name}':"]
            for index in indexes:
                output.append(
                    f"Key: {index['Key_name']}, Column: {index['Column_name']}, Seq: {index['Seq_in_index']}, Unique: {not bool(index['Non_unique'])}, Type: {index['Index_type']}"
                )
            return "\n".join(output)
  • server.py:17-17 (registration)
    The tool is registered via mcp.tool()(sql_tools.get_table_indexes) on line 17 of server.py.
    mcp.tool()(sql_tools.get_table_indexes)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, yet description only says 'Get index information' and 'Returns: str: Index metadata'. Lacks details on read-only nature, side effects, or permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Short and structured with Args/Returns sections, no unnecessary words. Minor improvement could be a single-line description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a simple tool with one parameter and a basic return description, but lacks detail on the structure of the returned metadata.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Description restates the parameter as 'Table name to inspect' with no additional meaning beyond the schema's title 'Table Name'. Schema coverage is 0% and no extra constraints or examples are given.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Get index information for a specific table' with a specific verb and resource, distinguishing it from sibling getters like get_table_schema or get_table_row_count.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Describes what the tool does but provides no guidance on when to use it over alternatives (e.g., get_table_schema) or any prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ajkeast/Coding-Buddy-MCP-Server'

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