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
| Name | Required | Description | Default |
|---|---|---|---|
| readonly | Yes | Set to true to enable read-only mode, false to disable |
Input Schema (JSON Schema)
{
"properties": {
"readonly": {
"description": "Set to true to enable read-only mode, false to disable",
"type": "boolean"
}
},
"required": [
"readonly"
],
"type": "object"
}
Implementation Reference
- src/index.ts:543-576 (handler)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"] } }
- src/index.ts:262-272 (schema)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"] }