Skip to main content
Glama

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
NameRequiredDescriptionDefault
modeYes

Implementation Reference

  • 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'], }, },
  • 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(), });
  • 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(), }), ]), ]);

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

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