Skip to main content
Glama

configure_gemini_token

Set up your Gemini API key to enable image generation through the Nano-Banana-MCP server. This tool configures authentication for accessing Google AI Studio's image generation capabilities.

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 `configureGeminiToken` that parses the API key using Zod, initializes the GoogleGenAI client, updates internal config state, saves the config to a file, and returns a success response.
    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;
      }
    }
  • Tool schema definition in the listTools response, specifying name, description, and inputSchema requiring 'apiKey' string.
    {
      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)
    Registration and dispatch of the 'configure_gemini_token' tool in the CallToolRequest switch statement.
    case "configure_gemini_token":
      return await this.configureGeminiToken(request);
  • src/index.ts:55-150 (registration)
    Tool registration in the ListToolsRequest handler, where 'configure_gemini_token' is included in the list of available tools.
    return {
      tools: [
        {
          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"],
          },
        },
        {
          name: "generate_image",
          description: "Generate a NEW image from text prompt. Use this ONLY when creating a completely new image, not when modifying an existing one.",
          inputSchema: {
            type: "object",
            properties: {
              prompt: {
                type: "string",
                description: "Text prompt describing the NEW image to create from scratch",
              },
            },
            required: ["prompt"],
          },
        },
        {
          name: "edit_image",
          description: "Edit a SPECIFIC existing image file, optionally using additional reference images. Use this when you have the exact file path of an image to modify.",
          inputSchema: {
            type: "object",
            properties: {
              imagePath: {
                type: "string",
                description: "Full file path to the main image file to edit",
              },
              prompt: {
                type: "string",
                description: "Text describing the modifications to make to the existing image",
              },
              referenceImages: {
                type: "array",
                items: {
                  type: "string"
                },
                description: "Optional array of file paths to additional reference images to use during editing (e.g., for style transfer, adding elements, etc.)",
              },
            },
            required: ["imagePath", "prompt"],
          },
        },
        {
          name: "get_configuration_status",
          description: "Check if Gemini API token is configured",
          inputSchema: {
            type: "object",
            properties: {},
            additionalProperties: false,
          },
        },
        {
          name: "continue_editing",
          description: "Continue editing the LAST image that was generated or edited in this session, optionally using additional reference images. Use this for iterative improvements, modifications, or changes to the most recent image. This automatically uses the previous image without needing a file path.",
          inputSchema: {
            type: "object",
            properties: {
              prompt: {
                type: "string",
                description: "Text describing the modifications/changes/improvements to make to the last image (e.g., 'change the hat color to red', 'remove the background', 'add flowers')",
              },
              referenceImages: {
                type: "array",
                items: {
                  type: "string"
                },
                description: "Optional array of file paths to additional reference images to use during editing (e.g., for style transfer, adding elements from other images, etc.)",
              },
            },
            required: ["prompt"],
          },
        },
        {
          name: "get_last_image_info",
          description: "Get information about the last generated/edited image in this session (file path, size, etc.). Use this to check what image is currently available for continue_editing.",
          inputSchema: {
            type: "object",
            properties: {},
            additionalProperties: false,
          },
        },
      ] as Tool[],
    };
  • Zod schema used for validating the Gemini API key in the configureGeminiToken handler.
    const ConfigSchema = z.object({
      geminiApiKey: z.string().min(1, "Gemini API key is required"),
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a configuration tool, implying a write/mutation operation, but doesn't describe key behaviors: whether this overwrites existing tokens, requires specific permissions, has side effects (e.g., affecting other tools), or what happens on success/failure. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's front-loaded with the core purpose ('Configure your Gemini API token') and includes necessary context ('for nano-banana image generation'). Every part of the sentence earns its place by specifying the action, resource, and application scope efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation operation for API configuration) and the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., success status, error messages), how it interacts with sibling tools (e.g., 'generate_image'), or behavioral details like persistence or validation. For a configuration tool with no structured support, more context is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't add any parameter-specific information beyond what's in the input schema, which has 100% coverage for the single parameter 'apiKey'. The schema already describes it as 'Your Gemini API key from Google AI Studio'. Since schema coverage is high, the baseline score is 3, as the description doesn't compensate but also doesn't detract from the schema's documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Configure your Gemini API token for nano-banana image generation.' It specifies the verb ('configure') and resource ('Gemini API token'), and mentions the context ('for nano-banana image generation'), which helps distinguish it from generic configuration tools. However, it doesn't explicitly differentiate from sibling tools like 'get_configuration_status', which might be related.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance. It implies this tool should be used to set up API tokens for image generation, but it doesn't specify when to use it (e.g., before generating images, when tokens expire) or when not to use it (e.g., if already configured). No alternatives or prerequisites are mentioned, leaving the agent with unclear operational context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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