Skip to main content
Glama

list_models

Retrieve available AI models to identify the best one for your specific question or find a model ID for use in chat tools.

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

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • Handler function that executes the list_models tool logic: maps config.models to ModelInfo[] and returns them as JSON in the MCP response format, with error handling.
    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}`, }, ], }; } }
  • Schema definition for the list_models tool, including title, description, and empty input schema (no parameters required).
    { 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({}), },
  • Registration of the list_models tool via server.registerTool, specifying name, schema, and inline handler.
    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}`, }, ], }; } } );

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