Skip to main content
Glama
zhaojw-php

MySQL ReadOnly MCP Server

by zhaojw-php

mysql_describe_table

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

Instructions

Get table structure and column information

Input Schema

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

Implementation Reference

  • Core handler function that constructs and executes the DESCRIBE SQL query to retrieve table structure and column information.
    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; }
  • Defines the input schema for the mysql_describe_table tool, specifying parameters table (required) and database (optional).
    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'], },
  • src/index.ts:59-76 (registration)
    Registers the mysql_describe_table tool in the list of available tools returned by ListToolsRequestHandler.
    { 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'], }, },
  • Dispatcher in CallToolRequestHandler that extracts arguments and delegates to MySQLConnection.describeTable, formats result as JSON.
    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), }, ], }; }

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