Skip to main content
Glama

update_mode

Modify an existing custom operational mode by updating its name, role definition, groups, or custom instructions using its unique slug identifier.

Instructions

Update an existing custom mode

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesSlug of the mode to update
updatesYes

Implementation Reference

  • Handler for update_mode tool: retrieves config, locates mode by slug, applies partial updates, validates the updated mode using CustomModeSchema, persists changes to config file, and returns success message.
    case 'update_mode': {
      const { slug, updates } = request.params.arguments as {
        slug: string;
        updates: Partial<z.infer<typeof CustomModeSchema>>;
      };
    
      const config = await this.readConfig();
      const index = config.customModes.findIndex((m) => m.slug === slug);
    
      if (index === -1) {
        throw new McpError(ErrorCode.InvalidParams, `Mode not found: ${slug}`);
      }
    
      const updatedMode = {
        ...config.customModes[index],
        ...updates,
      };
    
      try {
        CustomModeSchema.parse(updatedMode);
      } catch (error) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Invalid mode configuration: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    
      config.customModes[index] = updatedMode;
      await this.writeConfig(config);
    
      return {
        content: [
          {
            type: 'text',
            text: `Mode "${updatedMode.name}" updated successfully`,
          },
        ],
      };
    }
  • src/index.ts:247-290 (registration)
    Registration of update_mode tool in the list_tools handler, including name, description, and detailed inputSchema for slug and partial updates.
    {
      name: 'update_mode',
      description: 'Update an existing custom mode',
      inputSchema: {
        type: 'object',
        properties: {
          slug: {
            type: 'string',
            description: 'Slug of the mode to update',
          },
          updates: {
            type: 'object',
            properties: {
              name: { type: 'string' },
              roleDefinition: { type: 'string' },
              groups: {
                type: 'array',
                items: {
                  oneOf: [
                    { type: 'string' },
                    {
                      type: 'array',
                      items: [
                        { type: 'string' },
                        {
                          type: 'object',
                          properties: {
                            fileRegex: { type: 'string' },
                            description: { type: 'string' },
                          },
                          required: ['fileRegex', 'description'],
                        },
                      ],
                    },
                  ],
                },
              },
              customInstructions: { type: 'string' },
            },
          },
        },
        required: ['slug', 'updates'],
      },
    },
  • Zod schema CustomModeSchema used to validate the updated mode configuration in the update_mode handler.
    const CustomModeSchema = z.object({
      slug: z.string().regex(/^[a-z0-9-]+$/),
      name: z.string().min(1),
      roleDefinition: z.string().min(1),
      groups: z.array(GroupSchema),
      customInstructions: z.string().optional(),
    });
  • Zod schema GroupSchema defining allowed tool groups, used within CustomModeSchema for update_mode validation.
    const GroupSchema = z.union([
      z.string(),
      z.tuple([
        z.string(),
        z.object({
          fileRegex: z.string(),
          description: z.string(),
        }),
      ]),
    ]);
  • Helper method writeConfig used by update_mode to atomically persist the updated modes configuration to file.
    private async writeConfig(config: z.infer<typeof CustomModesConfigSchema>) {
      try {
        await fs.writeFile(
          this.configPath,
          JSON.stringify(config, null, 2),
          'utf-8'
        );
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to write config: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
Behavior2/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. It states this is an update operation, implying mutation, but doesn't disclose critical behavioral traits like required permissions, whether changes are reversible, error handling, or what happens to unspecified fields. For a mutation tool with zero annotation coverage, this leaves significant gaps.

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

Conciseness5/5

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

The description is extremely concise with a single, front-loaded sentence that directly states the tool's purpose. There is no wasted verbiage or unnecessary elaboration, making it efficient for quick understanding.

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

Completeness2/5

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

Given the tool's complexity (mutation with nested objects, no output schema, and no annotations), the description is inadequate. It doesn't address behavioral aspects, parameter details beyond the schema, or expected outcomes, leaving the agent with insufficient context to use the tool effectively.

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-specific information beyond what's in the schema. With 50% schema description coverage (only 'slug' has a description), the description doesn't compensate by explaining the 'updates' object structure, the meaning of fields like 'roleDefinition' or 'groups', or how nested arrays work. The baseline is 3 since schema coverage is moderate, but the description adds no value.

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

Purpose4/5

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

The description clearly states the action ('update') and resource ('an existing custom mode'), making the purpose immediately understandable. It distinguishes this as an update operation rather than creation or deletion, though it doesn't explicitly differentiate from sibling tools like 'validate_mode' which might also involve mode modifications.

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

Usage Guidelines2/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 prerequisites (e.g., needing an existing mode), when not to use it, or how it differs from siblings like 'create_mode' or 'validate_mode' in practical scenarios.

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

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/ccc0168/modes-mcp-server'

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