Skip to main content
Glama

list_supported_models

Discover available Gemini models compatible with the generateContent method for analyzing YouTube videos through the YouTube Vision MCP server.

Instructions

Lists available Gemini models that support the 'generateContent' method.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_supported_models' tool. It fetches the list of Gemini models from the REST API endpoint, filters for those supporting 'generateContent', and returns a formatted text list or an error response.
    case "list_supported_models": { try { console.error(`[INFO] Received request to list supported models.`); // Call the Gemini REST API to list models const listModelsUrl = `https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}`; const response = await fetch(listModelsUrl); if (!response.ok) { let errorDetail = await response.text(); let errorMessage = `Failed to fetch models from API (${response.status} ${response.statusText}).`; switch (response.status) { case 401: case 403: errorMessage = `Invalid API Key or permission denied for model listing.`; break; case 404: errorMessage = `Model listing API endpoint not found.`; break; case 429: errorMessage = `API quota exceeded for model listing.`; break; default: if (response.status >= 400 && response.status < 500) { errorMessage = `Invalid request to model listing API (${response.status}).`; } else if (response.status >= 500) { errorMessage = `Gemini API server error during model listing (${response.status}).`; } } throw new Error(`${errorMessage} Details: ${errorDetail}`); } const data = await response.json(); // Ensure data.models is an array before filtering const allModels: any[] = Array.isArray(data?.models) ? data.models : []; const supportedModels = allModels .filter(model => model.supportedGenerationMethods?.includes('generateContent')) .map(model => model.name); console.error(`[INFO] Found ${supportedModels.length} models supporting generateContent via REST API.`); if (supportedModels.length === 0) { return { content: [{ type: "text", text: "No models found supporting 'generateContent' via REST API." }], }; } return { content: [{ type: "text", text: `Models supporting 'generateContent' (fetched via REST API):\n- ${supportedModels.join('\n- ')}` }], }; } catch (error: any) { // Catch errors from fetch itself or the re-thrown error from response check console.error(`[ERROR] Failed during list_supported_models tool execution:`, error); let errorMessage = `Failed to list supported models.`; // Default message if (error.message) { errorMessage += ` Details: ${error.message}`; } return { content: [{ type: "text", text: errorMessage }], isError: true, }; } }
  • src/index.ts:86-90 (registration)
    Tool registration within the ListToolsRequestSchema handler, defining the tool's name, description, and empty input schema.
    { name: "list_supported_models", description: "Lists available Gemini models that support the 'generateContent' method.", inputSchema: zodToJsonSchema(z.object({})), // No input needed },
  • Input schema definition for the tool: an empty object schema since no parameters are required.
    inputSchema: zodToJsonSchema(z.object({})), // No input needed

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/minbang930/Youtube-Vision-MCP'

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