Skip to main content
Glama
sussa3007

MySql MCP Server

set_readonly

Control database access by enabling or disabling read-only mode for MySQL databases to restrict write operations or allow updates as needed.

Instructions

Enable or disable read-only mode

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
readonlyYesSet to true to enable read-only mode, false to disable

Implementation Reference

  • Handler function for the 'set_readonly' tool. Sets the 'readonly' flag in the global connectionConfig based on the input boolean parameter and returns a confirmation message.
    case "set_readonly": {
      try {
        const readonly = request.params.arguments?.readonly as boolean;
    
        if (readonly === undefined) {
          throw new Error("readonly parameter is required");
        }
    
        connectionConfig.readonly = readonly;
    
        return {
          content: [
            {
              type: "text",
              text: `Read-only mode ${readonly ? "enabled" : "disabled"}`
            }
          ],
          isError: false
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text:
                error instanceof Error
                  ? error.message
                  : "Unknown error occurred"
            }
          ],
          isError: true
        };
      }
    }
  • src/index.ts:259-273 (registration)
    Registration of the 'set_readonly' tool in the ListTools response, including its name, description, and input schema definition.
    {
      name: "set_readonly",
      description: "Enable or disable read-only mode",
      inputSchema: {
        type: "object",
        properties: {
          readonly: {
            type: "boolean",
            description:
              "Set to true to enable read-only mode, false to disable"
          }
        },
        required: ["readonly"]
      }
    }
  • Input schema for the 'set_readonly' tool, defining a required boolean 'readonly' parameter.
    inputSchema: {
      type: "object",
      properties: {
        readonly: {
          type: "boolean",
          description:
            "Set to true to enable read-only mode, false to disable"
        }
      },
      required: ["readonly"]
    }
Install Server

Other Tools

Related Tools

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

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