Skip to main content
Glama

MySQL ReadOnly MCP Server

by zhaojw-php

mysql_describe_table

Retrieve table structure and column details from MySQL databases to understand data organization and schema design for analysis or development purposes.

Instructions

Get table structure and column information

Input Schema

NameRequiredDescriptionDefault
tableYesTable name to describe
databaseNoDatabase name (optional, defaults to configured database)

Input Schema (JSON Schema)

{ "properties": { "database": { "description": "Database name (optional, defaults to configured database)", "type": "string" }, "table": { "description": "Table name to describe", "type": "string" } }, "required": [ "table" ], "type": "object" }

Implementation Reference

  • Core implementation of mysql_describe_table: executes DESCRIBE query to get table structure.
    async describeTable(table: string, database?: string): Promise<any[]> { const dbName = database || this.config.database; if (!dbName) { throw new Error('No database specified'); } const query = `DESCRIBE \`${dbName}\`.\`${table}\``; const result = await this.executeQuery(query); return result.rows; }
  • src/index.ts:59-76 (registration)
    Registers the mysql_describe_table tool in the list of available tools, including input schema.
    { name: 'mysql_describe_table', description: 'Get table structure and column information', inputSchema: { type: 'object', properties: { table: { type: 'string', description: 'Table name to describe', }, database: { type: 'string', description: 'Database name (optional, defaults to configured database)', }, }, required: ['table'], }, },
  • Tool dispatcher case that calls the MySQLConnection.describeTable method and returns JSON-formatted result.
    case 'mysql_describe_table': { const { table, database } = args as { table: string; database?: string }; const result = await mysqlConnection.describeTable(table, database); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Defines the input schema for mysql_describe_table tool.
    inputSchema: { type: 'object', properties: { table: { type: 'string', description: 'Table name to describe', }, database: { type: 'string', description: 'Database name (optional, defaults to configured database)', }, }, required: ['table'], },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhaojw-php/mysql-readonly-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server