Skip to main content
Glama
Darkstar326

MCP MySQL Server

by Darkstar326

mysql_list_databases

Retrieve a complete list of all databases available on your MySQL server to identify and access your data repositories.

Instructions

List all databases on the MySQL server

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • The handler function that executes the 'mysql_list_databases' tool. It checks for an active connection, runs 'SHOW DATABASES' query, and returns the list of databases as formatted text.
    private async handleListDatabases() { if (!this.pool) { throw new Error("Not connected to MySQL. Use mysql_connect first."); } try { const [results] = await this.pool.execute("SHOW DATABASES"); return { content: [ { type: "text", text: `Available databases:\n${JSON.stringify(results, null, 2)}`, }, ], }; } catch (error) { throw new Error(`Failed to list databases: ${error instanceof Error ? error.message : String(error)}`); } }
  • src/index.ts:157-164 (registration)
    Registration of the 'mysql_list_databases' tool in the ListTools handler, defining its name, description, and empty input schema (no parameters required).
    { name: "mysql_list_databases", description: "List all databases on the MySQL server", inputSchema: { type: "object", properties: {}, }, },
  • src/index.ts:253-254 (registration)
    Dispatch case in the CallToolRequest handler that routes calls to the mysql_list_databases tool to its handler function.
    case "mysql_list_databases": return await this.handleListDatabases();
  • Input schema for the mysql_list_databases tool, which requires no parameters.
    inputSchema: { type: "object", properties: {}, },

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

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