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;
    }
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but offers almost none. 'Switches to a specific mode' implies a state change, but it doesn't describe what effects this has (e.g., does it alter system behavior, require permissions, have side effects like resetting other states, or provide feedback?). It lacks details on success/failure conditions, response format, or any behavioral traits, making it inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just one sentence, 'Switches to a specific mode', which is front-loaded and wastes no words. However, this brevity borders on under-specification, as it lacks necessary detail for a tool that likely performs a state mutation. While efficient, it could benefit from additional context to earn a higher score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a mode-switching tool (likely a state mutation with no annotations and no output schema), the description is severely incomplete. It doesn't explain what 'mode' entails, what happens after switching, potential errors, or how it interacts with sibling tools. For a tool that may change system behavior, this minimal description fails to provide the context needed for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter semantics beyond what the input schema provides. The schema has 100% description coverage, with the 'mode' parameter clearly documented as 'Name of the mode to switch to (architect, ask, code, debug, test)'. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract from the schema's completeness.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Switches to a specific mode' is a tautology that essentially restates the tool name 'switch_mode' without adding meaningful specificity. It mentions the action 'switches' and the resource 'mode', but fails to clarify what 'mode' means in this context or what the tool actually accomplishes beyond the literal interpretation of its name. Compared to siblings like 'get_current_mode' or 'update_active_context', it doesn't distinguish its purpose clearly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, context for switching modes, or refer to sibling tools like 'get_current_mode' (which might be used before switching) or 'update_active_context' (which might be related). There's no indication of when this tool is appropriate or what scenarios it's designed for, leaving the agent with no usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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