list_modes
Retrieve all available custom operational modes from the Modes MCP Server to manage configurations and enable real-time control.
Instructions
List all custom modes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:331-341 (handler)Handler for the 'list_modes' tool that reads the configuration file using readConfig() and returns the customModes array as formatted JSON text in the MCP response.case 'list_modes': { const config = await this.readConfig(); return { content: [ { type: 'text', text: JSON.stringify(config.customModes, null, 2), }, ], }; }
- src/index.ts:176-183 (registration)Registration of the 'list_modes' tool in the ListTools response, including its name, description, and empty input schema.{ name: 'list_modes', description: 'List all custom modes', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:61-64 (schema)Zod schema for the modes configuration file structure, which defines the format of data returned by list_modes (array of custom modes).const CustomModesConfigSchema = z.object({ customModes: z.array(CustomModeSchema), });
- src/index.ts:132-148 (helper)Helper function to read, parse, and validate the modes configuration file, directly used by the list_modes handler.private async readConfig() { try { // Create default config if file doesn't exist if (!fs.existsSync(this.configPath)) { await fs.writeFile(this.configPath, JSON.stringify({ customModes: [] }, null, 2), 'utf-8'); } const content = await fs.readFile(this.configPath, 'utf-8'); const config = JSON.parse(content); return CustomModesConfigSchema.parse(config); } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to read config: ${error instanceof Error ? error.message : String(error)}` ); } }