describe_table
Retrieve detailed schema information for a specified table using SingleStore MCP Server. Ideal for understanding table structure, field types, and metadata.
Instructions
Get detailed information about a table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Name of the table to describe |
Implementation Reference
- src/index.ts:1489-1541 (handler)Main handler implementation for the 'describe_table' tool. Validates input, queries DESCRIBE for schema, COUNT(*) for statistics, and SELECT LIMIT 5 for sample data, returns structured JSON response.case 'describe_table': { if (!request.params.arguments || typeof request.params.arguments.table !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'Table parameter must be a string' ); } try { // Get table schema const [columns] = await conn.query( 'DESCRIBE ??', [request.params.arguments.table] ) as [ColumnRowDataPacket[], mysql.FieldPacket[]]; // Get basic table statistics const [stats] = await conn.query( 'SELECT COUNT(*) as total_rows FROM ??', [request.params.arguments.table] ) as [mysql.RowDataPacket[], mysql.FieldPacket[]]; // Sample some data const [sample] = await conn.query( 'SELECT * FROM ?? LIMIT 5', [request.params.arguments.table] ) as [mysql.RowDataPacket[], mysql.FieldPacket[]]; const statistics = stats[0] as { total_rows: number }; return { content: [ { type: 'text', text: JSON.stringify( { schema: columns, statistics, sample_data: sample, }, null, 2 ), }, ], }; } catch (error: unknown) { const err = error as Error; throw new McpError( ErrorCode.InternalError, `Table description error: ${err.message}` ); } }
- src/index.ts:1210-1222 (registration)Tool registration including name, description, and input schema in the MCP server's ListTools response.name: 'describe_table', description: 'Get detailed information about a table', inputSchema: { type: 'object', properties: { table: { type: 'string', description: 'Name of the table to describe', }, }, required: ['table'], }, },
- src/index.ts:1212-1222 (schema)Input schema definition for the 'describe_table' tool requiring a 'table' string parameter.inputSchema: { type: 'object', properties: { table: { type: 'string', description: 'Name of the table to describe', }, }, required: ['table'], }, },
- src/index.ts:22-29 (helper)Type interface used in the describe_table handler for typing DESCRIBE query results.interface ColumnRowDataPacket extends mysql.RowDataPacket { Field: string; Type: string; Null: string; Key: string; Default?: string; Extra?: string; }
- src/index.ts:170-182 (registration)Secondary tool registration in SSE handleRequest cached tools list (identical schema).name: 'describe_table', description: 'Get detailed information about a table', inputSchema: { type: 'object', properties: { table: { type: 'string', description: 'Name of the table to describe', }, }, required: ['table'], }, },