MySQL Create Index
mysql_create_indexCreate indexes on MySQL tables with support for BTREE, HASH, FULLTEXT, and SPATIAL index types. Define unique indexes and add IF NOT EXISTS clause.
Instructions
Create an index on a table. Supports BTREE, HASH, FULLTEXT, and SPATIAL index types.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Index name | |
| type | No | Index type | |
| table | No | Table name | |
| unique | No | Create unique index | |
| columns | No | Columns to index. Anti-Hallucination Hint: Must be an array of strings (e.g. ['id', 'status']), not a single string or an array of objects. | |
| indexName | No | Alias for name | |
| tableName | No | Alias for table | |
| ifNotExists | No | Add IF NOT EXISTS clause |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Error code (e.g. VALIDATION_ERROR, QUERY_ERROR) | |
| data | No | ||
| error | No | Error message if operation failed | |
| details | No | Additional error context | |
| metrics | No | Token estimation metrics | |
| success | Yes | Whether the operation succeeded | |
| category | No | Error category (validation, query, connection, internal) | |
| suggestion | No | Suggested fix for the error | |
| recoverable | No | Whether the error is recoverable |