maintenance_mode
Enable or disable specific tools for maintenance simulation on the example-mcp-server-stdio. Manage tool availability with a simple boolean input.
Instructions
Simulate enabling or disabling tools for maintenance (demo only)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| enable | Yes | Enable (true) or disable (false) the tool | |
| toolName | Yes | Tool to simulate managing |
Implementation Reference
- src/server.ts:1225-1250 (handler)The handler function for the maintenance_mode tool. Simulates enabling or disabling a specified tool (calculate, batch_calculate, or advanced_calculate) 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 input schema for maintenance_mode tool defining 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 output schema for maintenance_mode tool defining status, toolName, enabled, and message fields.const maintenanceModeOutputSchema = { status: z.string(), toolName: z.string(), enabled: z.boolean(), message: z.string(), };
- src/server.ts:1217-1251 (registration)Registration of the maintenance_mode tool using server.registerTool within the registerManagementTools function, specifying name, metadata, schemas, and handler.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, }, }; }, );