Skip to main content
Glama

configure_gemini_token

Set up your Gemini API token from Google AI Studio to enable image generation capabilities in the Nano-Banana MCP server.

Instructions

Configure your Gemini API token for nano-banana image generation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiKeyYesYour Gemini API key from Google AI Studio

Implementation Reference

  • The main handler function for the configure_gemini_token tool. It extracts the apiKey from the request, validates it using ConfigSchema, initializes the GoogleGenAI instance, sets configuration flags, saves the config to a file, and returns a success message.
    private async configureGeminiToken(request: CallToolRequest): Promise<CallToolResult> { const { apiKey } = request.params.arguments as { apiKey: string }; try { ConfigSchema.parse({ geminiApiKey: apiKey }); this.config = { geminiApiKey: apiKey }; this.genAI = new GoogleGenAI({ apiKey }); this.configSource = 'config_file'; // Manual configuration via tool await this.saveConfig(); return { content: [ { type: "text", text: "✅ Gemini API token configured successfully! You can now use nano-banana image generation features.", }, ], }; } catch (error) { if (error instanceof z.ZodError) { throw new McpError(ErrorCode.InvalidParams, `Invalid API key: ${error.errors[0]?.message}`); } throw error; } }
  • The input schema for the configure_gemini_token tool, defining a required 'apiKey' string property.
    inputSchema: { type: "object", properties: { apiKey: { type: "string", description: "Your Gemini API key from Google AI Studio", }, }, required: ["apiKey"], },
  • src/index.ts:57-70 (registration)
    Registration of the configure_gemini_token tool in the ListTools response, including name, description, and input schema.
    { name: "configure_gemini_token", description: "Configure your Gemini API token for nano-banana image generation", inputSchema: { type: "object", properties: { apiKey: { type: "string", description: "Your Gemini API key from Google AI Studio", }, }, required: ["apiKey"], }, },
  • src/index.ts:156-157 (registration)
    Dispatch case in the CallToolRequest handler that routes execution to the configureGeminiToken method.
    case "configure_gemini_token": return await this.configureGeminiToken(request);
  • Internal Zod schema used for validating the Gemini API key in the handler.
    const ConfigSchema = z.object({ geminiApiKey: z.string().min(1, "Gemini API key is required"), });

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/ConechoAI/Nano-Banana-MCP'

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