describe_table
Retrieve the schema for a MariaDB table to understand its structure, columns, and data types for database analysis or query planning.
Instructions
Show the schema for a specific table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Database name (optional, uses default if not specified) | |
| table | Yes | Table name |
Implementation Reference
- src/index.ts:137-146 (handler)Handler for the 'describe_table' tool: validates input, executes DESCRIBE query on the table (optionally using specified database), and returns the result rows as formatted JSON text.case "describe_table": { const tbl = args.table as string; if (!tbl) throw new McpError(ErrorCode.InvalidParams, "`table` is required"); const db = args.database as string | undefined; const { rows } = await executeQuery(`DESCRIBE \`${tbl}\``, [], db); return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }], }; }
- src/index.ts:95-103 (registration)Registration of the 'describe_table' tool in the ListTools response, including name, description, and input schema definition.{ name: "describe_table", description: "Show schema of a table", inputSchema: { type: "object", properties: { database: { type: "string" }, table: { type: "string" } }, required: ["table"], }, },
- src/index.ts:98-103 (schema)Input schema for the 'describe_table' tool defining required 'table' parameter and optional 'database'.inputSchema: { type: "object", properties: { database: { type: "string" }, table: { type: "string" } }, required: ["table"], }, },