Skip to main content
Glama
pickstar-2002

MySQL MCP Server

mysql_list_databases

Retrieve a list of all databases in MySQL. This tool helps users quickly access and view database names for management or query purposes.

Instructions

列出所有数据库

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'mysql_list_databases' tool. Calls DatabaseManager.listDatabases() and formats the response as text content.
    private async handleListDatabases(): Promise<any> { const databases = await this.dbManager.listDatabases(); return { content: [ { type: 'text', text: `数据库列表:\n${JSON.stringify(databases, null, 2)}`, }, ], }; }
  • Core implementation that executes SQL query against information_schema.SCHEMATA to retrieve list of user databases.
    async listDatabases(): Promise<DatabaseInfo[]> { const result = await this.query(` SELECT SCHEMA_NAME as name, DEFAULT_CHARACTER_SET_NAME as charset, DEFAULT_COLLATION_NAME as collation FROM information_schema.SCHEMATA WHERE SCHEMA_NAME NOT IN ('information_schema', 'performance_schema', 'mysql', 'sys') ORDER BY SCHEMA_NAME `); return result.rows as DatabaseInfo[]; }
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    { name: 'mysql_list_databases', description: '列出所有数据库', inputSchema: { type: 'object', properties: {}, }, },
  • src/server.ts:237-238 (registration)
    Switch case in CallToolRequestSchema handler that routes 'mysql_list_databases' calls to the handler function.
    case 'mysql_list_databases': return await this.handleListDatabases();

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/pickstar-2002/mysql-mcp'

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