Skip to main content
Glama
autoexecbatman

Enhanced Architecture MCP

model_list

Discover available local AI models to select the appropriate one for your tasks. This tool helps users identify and choose from installed models.

Instructions

List available local AI models

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'model_list' tool. Fetches the list of available models from the Ollama API at /api/tags, formats them with size and modified time, and returns a formatted text response.
    async getModelList() { try { const response = await fetch(`${this.ollamaUrl}/api/tags`); if (!response.ok) { throw new Error(`Ollama API error: ${response.status}`); } const data = await response.json(); const modelList = data.models.map(model => ({ name: model.name, size: this.formatBytes(model.size), modified: model.modified_at })); return { content: [ { type: 'text', text: `Available Local Models:\n\n${JSON.stringify(modelList, null, 2)}` } ] }; } catch (error) { throw new Error(`Failed to get model list: ${error.message}`); }
  • Input schema for the 'model_list' tool, which is an empty object since no parameters are required.
    inputSchema: { type: 'object', properties: {}, required: [] }
  • Registration of the 'model_list' tool in the ListToolsRequestHandler response, including name, description, and input schema.
    { name: 'model_list', description: 'List available local AI models', inputSchema: { type: 'object', properties: {}, required: [] } },
  • Dispatch case in CallToolRequestHandler that invokes the getModelList handler for 'model_list' tool calls.
    case 'model_list': return await this.getModelList();
  • Helper function used by getModelList to format model file sizes from bytes to human-readable format.
    formatBytes(bytes) { if (bytes === 0) return '0 Bytes'; const k = 1024; const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; }

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/autoexecbatman/arch-mcp'

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