Skip to main content
Glama

list_models

Retrieve available AI models to identify the best one for your specific query or find model IDs for chat interactions.

Instructions

Get all the models you can chat with. Each model has different strengths and expertise. Call this first to see which model is best for your question, or to find a specific model ID to use in the chat tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'list_models' tool using server.registerTool, including title, description, empty inputSchema, and inline handler function.
    server.registerTool( "list_models", { title: "See Available Models to Talk To", description: "Get all the models you can chat with. Each model has different strengths and expertise. Call this first to see which model is best for your question, or to find a specific model ID to use in the chat tool.", inputSchema: z.object({}), }, async () => { try { const models: ModelInfo[] = config.models.map((m) => ({ id: m.id, modelName: m.modelName, baseUrl: m.baseUrl, })); logger.debug("Listed models", { count: models.length }); return { content: [ { type: "text" as const, text: JSON.stringify({ models, }), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); logger.error( "List models tool error", error instanceof Error ? error : new Error(errorMessage) ); return { content: [ { type: "text" as const, text: `Error: ${errorMessage}`, }, ], }; } } );
  • The handler function for list_models tool. It extracts model info from config.models, logs the count, and returns a JSON-stringified list of models in the MCP response format. Handles errors gracefully.
    async () => { try { const models: ModelInfo[] = config.models.map((m) => ({ id: m.id, modelName: m.modelName, baseUrl: m.baseUrl, })); logger.debug("Listed models", { count: models.length }); return { content: [ { type: "text" as const, text: JSON.stringify({ models, }), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); logger.error( "List models tool error", error instanceof Error ? error : new Error(errorMessage) ); return { content: [ { type: "text" as const, text: `Error: ${errorMessage}`, }, ], }; } }
  • Tool schema definition including title, description, and inputSchema (zod object with no properties, as no input params are needed).
    { title: "See Available Models to Talk To", description: "Get all the models you can chat with. Each model has different strengths and expertise. Call this first to see which model is best for your question, or to find a specific model ID to use in the chat tool.", inputSchema: z.object({}), },
Install Server

Other 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/danielwpz/polybrain-mcp'

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