Skip to main content
Glama

create_mode

Create custom operational modes by defining unique identifiers, display names, role capabilities, and allowed tool groups for enhanced server configuration management.

Instructions

Create a new custom mode

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesUnique slug for the mode (lowercase letters, numbers, and hyphens)
nameYesDisplay name for the mode
roleDefinitionYesDetailed description of the mode's role and capabilities
groupsYesArray of allowed tool groups
customInstructionsNoOptional additional instructions for the mode

Implementation Reference

  • Handler for the 'create_mode' tool. Extracts arguments, reads config, checks for existing mode by slug, validates using CustomModeSchema, appends new mode, writes config, returns success message.
    case 'create_mode': { const mode = request.params.arguments as z.infer<typeof CustomModeSchema>; const config = await this.readConfig(); if (config.customModes.some((m) => m.slug === mode.slug)) { throw new McpError( ErrorCode.InvalidParams, `Mode with slug "${mode.slug}" already exists` ); } try { CustomModeSchema.parse(mode); } catch (error) { throw new McpError( ErrorCode.InvalidParams, `Invalid mode configuration: ${error instanceof Error ? error.message : String(error)}` ); } config.customModes.push(mode); await this.writeConfig(config); return { content: [ { type: 'text', text: `Mode "${mode.name}" created successfully`, }, ], }; }
  • Zod schema used for validating the create_mode input parameters and mode configuration.
    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 for group definitions used within CustomModeSchema.
    const GroupSchema = z.union([ z.string(), z.tuple([ z.string(), z.object({ fileRegex: z.string(), description: z.string(), }), ]), ]);
  • src/index.ts:198-246 (registration)
    Tool registration in the list_tools response, including name, description, and input schema matching the Zod schema.
    { name: 'create_mode', description: 'Create a new custom mode', inputSchema: { type: 'object', properties: { slug: { type: 'string', description: 'Unique slug for the mode (lowercase letters, numbers, and hyphens)', }, name: { type: 'string', description: 'Display name for the mode', }, roleDefinition: { type: 'string', description: 'Detailed description of the mode\'s role and capabilities', }, groups: { type: 'array', items: { oneOf: [ { type: 'string' }, { type: 'array', items: [ { type: 'string' }, { type: 'object', properties: { fileRegex: { type: 'string' }, description: { type: 'string' }, }, required: ['fileRegex', 'description'], }, ], }, ], }, description: 'Array of allowed tool groups', }, customInstructions: { type: 'string', description: 'Optional additional instructions for the mode', }, }, required: ['slug', 'name', 'roleDefinition', 'groups'], }, },

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