Maintenance Mode
maintenance_modeEnable or disable tools for maintenance periods to control availability and manage updates without affecting active operations.
Instructions
Simulate enabling or disabling tools for maintenance (demo only)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| toolName | Yes | Tool to simulate managing | |
| enable | Yes | Enable (true) or disable (false) the tool |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| enabled | Yes | ||
| message | Yes | ||
| toolName | Yes |
Implementation Reference
- src/server.ts:1225-1250 (handler)The anonymous async function that implements the core logic of the 'maintenance_mode' tool. It simulates enabling or disabling specified tools by logging the action, incrementing a request counter, generating a status message, and returning both markdown text content and structured JSON output.
async ({ toolName, enable }) => { log.info(`Simulating maintenance mode for ${toolName}: ${enable ? 'enabled' : 'disabled'}`); requestCount++; // NOTE: In a real implementation, this would use tool handles to actually // enable/disable tools. For this educational demo, we simulate the action. const message = enable ? `Tool '${toolName}' would be enabled and available for use.` : `Tool '${toolName}' would be disabled for maintenance and temporarily unavailable.`; return { content: [ { type: 'text', text: `## Maintenance Mode (Demo)\n\n${message}\n\n**Note**: This is a demonstration tool. In a production server, this would use actual tool lifecycle management.`, }, ], structuredContent: { status: enable ? 'enabled' : 'disabled', toolName, enabled: enable, message, }, }; }, - src/server.ts:1203-1208 (schema)Zod schema defining the input parameters for the 'maintenance_mode' tool: toolName (enum of calculator tools) and enable (boolean).
const maintenanceModeInputSchema = { toolName: z .enum(['calculate', 'batch_calculate', 'advanced_calculate']) .describe('Tool to simulate managing'), enable: z.boolean().describe('Enable (true) or disable (false) the tool'), }; - src/server.ts:1210-1215 (schema)Zod schema defining the structured output for the 'maintenance_mode' tool: status, toolName, enabled, and message.
const maintenanceModeOutputSchema = { status: z.string(), toolName: z.string(), enabled: z.boolean(), message: z.string(), }; - src/server.ts:1217-1251 (registration)The server.registerTool call that registers the 'maintenance_mode' tool, specifying its name, metadata (title, description), input/output schemas, and inline handler function.
server.registerTool( 'maintenance_mode', { title: 'Maintenance Mode', description: 'Simulate enabling or disabling tools for maintenance (demo only)', inputSchema: maintenanceModeInputSchema, outputSchema: maintenanceModeOutputSchema, }, async ({ toolName, enable }) => { log.info(`Simulating maintenance mode for ${toolName}: ${enable ? 'enabled' : 'disabled'}`); requestCount++; // NOTE: In a real implementation, this would use tool handles to actually // enable/disable tools. For this educational demo, we simulate the action. const message = enable ? `Tool '${toolName}' would be enabled and available for use.` : `Tool '${toolName}' would be disabled for maintenance and temporarily unavailable.`; return { content: [ { type: 'text', text: `## Maintenance Mode (Demo)\n\n${message}\n\n**Note**: This is a demonstration tool. In a production server, this would use actual tool lifecycle management.`, }, ], structuredContent: { status: enable ? 'enabled' : 'disabled', toolName, enabled: enable, message, }, }; }, );