Skip to main content
Glama

switch_mode

Change the operational mode of the MCP server (architect, ask, code, debug, test) to align tasks with specific functionalities. Supports centralized SSH-based knowledge management.

Instructions

Switches to a specific mode

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYesName of the mode to switch to (architect, ask, code, debug, test)

Implementation Reference

  • Defines the tool metadata, description, and input schema for 'switch_mode'.
    { name: 'switch_mode', description: 'Switches to a specific mode', inputSchema: { type: 'object', properties: { mode: { type: 'string', description: 'Name of the mode to switch to (architect, ask, code, debug, test)', }, }, required: ['mode'], }, },
  • Primary handler function that validates the input mode and delegates to MemoryBankManager.switchMode, returning appropriate success/error responses.
    export function handleSwitchMode(memoryBankManager: MemoryBankManager, mode: string) { const validModes = ['architect', 'ask', 'code', 'debug', 'test']; if (!validModes.includes(mode)) { return { content: [ { type: 'text', text: `Invalid mode: ${mode}. Valid modes are: ${validModes.join(', ')}`, }, ], isError: true, }; } const success = memoryBankManager.switchMode(mode); if (!success) { return { content: [ { type: 'text', text: `Failed to switch to mode ${mode}. Make sure the .clinerules-${mode} file exists in the project directory.`, }, ], isError: true, }; } return { content: [ { type: 'text', text: `Successfully switched to mode ${mode}.`, }, ], }; }
  • Registers the modeTools (including switch_mode) for tool listing requests.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ ...coreTools, ...progressTools, ...contextTools, ...decisionTools, ...modeTools, ], }));
  • Routes switch_mode tool calls to the handleSwitchMode function in the main tool request handler.
    case 'switch_mode': { const { mode } = request.params.arguments as { mode: string }; if (!mode) { throw new McpError(ErrorCode.InvalidParams, 'Mode not specified'); } return handleSwitchMode(memoryBankManager, mode); }
  • Underlying method invoked by the tool handler to perform the actual mode switch (minimal implementation).
    switchMode(mode: string): boolean { logger.debug('MemoryBankManager', `Switching to mode: ${mode}`); // Minimal implementation return true; }

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/aakarsh-sasi/memory-bank-mcp'

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