list_models
Discover available Gemini AI models and their capabilities to select the right one for tasks like reasoning, vision processing, or JSON generation.
Instructions
List all available Gemini models and their capabilities
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Filter models by capability |
Implementation Reference
- src/enhanced-stdio-server.ts:786-828 (handler)Main execution logic for the list_models tool. Filters GEMINI_MODELS based on optional 'filter' parameter and returns JSON-formatted list.private listModels(id: any, args: any): MCPResponse { const filter = args?.filter || 'all'; let models = Object.entries(GEMINI_MODELS); if (filter !== 'all') { models = models.filter(([_, info]) => { switch (filter) { case 'thinking': return 'thinking' in info && info.thinking === true; case 'vision': return info.features.includes('function_calling'); // All current models support vision case 'grounding': return info.features.includes('grounding'); case 'json_mode': return info.features.includes('json_mode'); default: return true; } }); } const modelList = models.map(([name, info]) => ({ name, ...info })); return { jsonrpc: '2.0', id, result: { content: [ { type: 'text', text: JSON.stringify(modelList, null, 2) } ], metadata: { count: modelList.length, filter } } }; }
- src/enhanced-stdio-server.ts:496-497 (registration)Dispatch case in handleToolCall method that routes list_models tool calls to the handler.case 'list_models': return this.listModels(request.id, args);
- src/enhanced-stdio-server.ts:338-351 (registration)Tool registration in getAvailableTools() - defines name, description, and input schema advertised in tools/list response.{ name: 'list_models', description: 'List all available Gemini models and their capabilities', inputSchema: { type: 'object', properties: { filter: { type: 'string', description: 'Filter models by capability', enum: ['all', 'thinking', 'vision', 'grounding', 'json_mode'] } } } },
- src/utils/validation.ts:98-100 (schema)Zod validation schema for list_models parameters (defined but not explicitly used in handler).listModels: z.object({ filter: z.enum(['all', 'thinking', 'vision', 'grounding', 'json_mode']).optional() }),
- src/enhanced-stdio-server.ts:17-66 (helper)Data structure of available models used by the list_models handler to generate the response.const GEMINI_MODELS = { // Thinking models (2.5 series) - latest and most capable 'gemini-2.5-pro': { description: 'Most capable thinking model, best for complex reasoning and coding', features: ['thinking', 'function_calling', 'json_mode', 'grounding', 'system_instructions'], contextWindow: 2000000, // 2M tokens thinking: true }, 'gemini-2.5-flash': { description: 'Fast thinking model with best price/performance ratio', features: ['thinking', 'function_calling', 'json_mode', 'grounding', 'system_instructions'], contextWindow: 1000000, // 1M tokens thinking: true }, 'gemini-2.5-flash-lite': { description: 'Ultra-fast, cost-efficient thinking model for high-throughput tasks', features: ['thinking', 'function_calling', 'json_mode', 'system_instructions'], contextWindow: 1000000, thinking: true }, // 2.0 series 'gemini-2.0-flash': { description: 'Fast, efficient model with 1M context window', features: ['function_calling', 'json_mode', 'grounding', 'system_instructions'], contextWindow: 1000000 }, 'gemini-2.0-flash-lite': { description: 'Most cost-efficient model for simple tasks', features: ['function_calling', 'json_mode', 'system_instructions'], contextWindow: 1000000 }, 'gemini-2.0-pro-experimental': { description: 'Experimental model with 2M context, excellent for coding', features: ['function_calling', 'json_mode', 'grounding', 'system_instructions'], contextWindow: 2000000 }, // Legacy models (for compatibility) 'gemini-1.5-pro': { description: 'Previous generation pro model', features: ['function_calling', 'json_mode', 'system_instructions'], contextWindow: 2000000 }, 'gemini-1.5-flash': { description: 'Previous generation fast model', features: ['function_calling', 'json_mode', 'system_instructions'], contextWindow: 1000000 } };