describe_table
Display the schema structure of a MySQL database table to understand column definitions, data types, and constraints.
Instructions
Show the schema for a specific table
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"table": "<table>"
},
"name": "describe_table"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Database name (optional, uses default if not specified) | |
| table | Yes | Table name |
Implementation Reference
- src/index.ts:171-194 (handler)The handler function for the 'describe_table' tool. Extracts 'database' (optional) and 'table' (required) parameters, executes a DESCRIBE query via the executeQuery helper, and returns the table schema as JSON-formatted rows.
case "describe_table": { console.error('[Tool] Executing describe_table'); const database = request.params.arguments?.database as string | undefined; const table = request.params.arguments?.table as string; if (!table) { throw new McpError(ErrorCode.InvalidParams, "Table name is required"); } const { rows } = await executeQuery( pool, `DESCRIBE \`${table}\``, [], database ); return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }] }; } - src/index.ts:89-106 (registration)Registration of the 'describe_table' tool within the ListToolsRequestSchema handler. Includes the tool's name, description, and input schema definition.
{ name: "describe_table", description: "Show the schema for a specific table", inputSchema: { type: "object", properties: { database: { type: "string", description: "Database name (optional, uses default if not specified)" }, table: { type: "string", description: "Table name" } }, required: ["table"] } },