Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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: {}, }, },
  • 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), });
  • 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)}` ); } }

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