describe_index
Show indexes for a specific MySQL table to analyze indexing and optimize query performance.
Instructions
Show indexes for a specific table.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | The name of the table to show indexes for. |
Implementation Reference
- src/index.ts:120-134 (registration)Registration of the 'describe_index' tool via server.registerTool(), with inputSchema and the handler callback.
server.registerTool( 'describe_index', { description: 'Show indexes for a specific table.', inputSchema: z.object({ table: z.string().describe('The name of the table to show indexes for.'), }), }, async ({ table }) => { const results = await db.query(`SHOW INDEX FROM ${table}`); return { content: [{ type: 'text', text: JSON.stringify(results, null, 2) }], }; } ); - src/index.ts:122-127 (schema)Input schema for 'describe_index': requires a 'table' string field.
{ description: 'Show indexes for a specific table.', inputSchema: z.object({ table: z.string().describe('The name of the table to show indexes for.'), }), }, - src/index.ts:128-133 (handler)Handler function for 'describe_index': executes 'SHOW INDEX FROM {table}' and returns JSON results.
async ({ table }) => { const results = await db.query(`SHOW INDEX FROM ${table}`); return { content: [{ type: 'text', text: JSON.stringify(results, null, 2) }], }; }