validate_mode
Check mode configuration for errors or issues before implementation. Validate inputs like slug, name, role definition, and groups to ensure correct setup without saving changes.
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 from arguments, parses it using CustomModeSchema, and returns a success message or validation error 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:305-325 (registration)Registration of the 'validate_mode' tool in the ListTools response, defining its name, description, and JSON input schema.{ 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'], }, },
- src/index.ts:50-56 (schema)Zod schema (CustomModeSchema) used by the validate_mode handler for parsing and validating the mode configuration object.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:31-40 (schema)Supporting Zod schema (GroupSchema) used within CustomModeSchema for validating group permissions in modes.const GroupSchema = z.union([ z.string(), z.tuple([ z.string(), z.object({ fileRegex: z.string(), description: z.string(), }), ]), ]);