status
Verify the connection status of your MySQL database to ensure seamless operations and troubleshoot connectivity issues effectively.
Instructions
Check the current database connection status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| random_string | Yes | Dummy parameter for no-parameter tools |
Input Schema (JSON Schema)
{
"properties": {
"random_string": {
"description": "Dummy parameter for no-parameter tools",
"type": "string"
}
},
"required": [
"random_string"
],
"type": "object"
}
Implementation Reference
- src/index.ts:282-329 (handler)Handler for the 'status' tool: checks if database connection exists and returns JSON with connection details or disconnection message.case "status": { if (!connection) { return { content: [ { type: "text", text: JSON.stringify( { connected: false, message: "Database not connected. Need to use 'connect' tool after checking current environment variable information. The password is sensitive information and is stored in an environment variable, so it is not required in the request parameters.", host: connectionConfig.host, port: connectionConfig.port, user: connectionConfig.user, database: connectionConfig.database, readonly: connectionConfig.readonly }, null, 2 ) } ], isError: false }; } return { content: [ { type: "text", text: JSON.stringify( { connected: true, host: connectionConfig.host, port: connectionConfig.port, user: connectionConfig.user, database: connectionConfig.database, threadId: connection.threadId, readonly: connectionConfig.readonly }, null, 2 ) } ], isError: false }; }
- src/index.ts:142-151 (schema)Input schema for 'status' tool, defines a required dummy 'random_string' parameter since MCP requires at least one parameter.inputSchema: { type: "object", properties: { random_string: { type: "string", description: "Dummy parameter for no-parameter tools" } }, required: ["random_string"] }
- src/index.ts:139-152 (registration)Registration of the 'status' tool in the listTools response, providing name, description, and schema.{ name: "status", description: "Check the current database connection status.", inputSchema: { type: "object", properties: { random_string: { type: "string", description: "Dummy parameter for no-parameter tools" } }, required: ["random_string"] } },