validate_mode
Check mode configuration for errors before saving to ensure proper setup in the Modes MCP Server.
Instructions
Validate a mode configuration without saving it
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes |
Implementation Reference
- src/index.ts:457-483 (handler)The handler function for the 'validate_mode' tool. It extracts the mode object from the request arguments, attempts to parse/validate it using CustomModeSchema.parse(), and returns a success message or an error message with isError: true.case 'validate_mode': { const { mode } = request.params.arguments as { mode: z.infer<typeof CustomModeSchema>; }; try { CustomModeSchema.parse(mode); return { content: [ { type: 'text', text: 'Mode configuration is valid', }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Invalid mode configuration: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/index.ts:50-56 (schema)Zod schema (CustomModeSchema) defining the structure and validation rules for a custom mode configuration, used directly in the validate_mode handler for input validation.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(), });
- src/index.ts:305-325 (registration)Tool registration in the list_tools handler, defining the name, description, and JSON input schema for the validate_mode tool.{ name: 'validate_mode', description: 'Validate a mode configuration without saving it', inputSchema: { type: 'object', properties: { mode: { type: 'object', properties: { slug: { type: 'string' }, name: { type: 'string' }, roleDefinition: { type: 'string' }, groups: { type: 'array' }, customInstructions: { type: 'string' }, }, required: ['slug', 'name', 'roleDefinition', 'groups'], }, }, required: ['mode'], }, },