Skip to main content
Glama
taylorleese

mcp-toolz

ask_gemini

Ask Google Gemini questions about specific context entries or request general second opinions to enhance understanding and decision-making.

Instructions

Ask Google Gemini a question about a context entry, or get a general second opinion

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_idYesContext ID to ask about
questionNoOptional specific question to ask about the context. If not provided, gets a general second opinion.

Implementation Reference

  • Main MCP tool handler for 'ask_gemini': retrieves context by ID, calls GeminiClient.get_second_opinion, updates storage if no specific question, formats and returns response.
    if name == "ask_gemini":
        context_id = arguments["context_id"]
        question = arguments.get("question")
        context = self.storage.get_context(context_id)
        if not context:
            return [TextContent(type="text", text=f"Context {context_id} not found")]
    
        try:
            gemini_client = GeminiClient()
            response = gemini_client.get_second_opinion(context, question)
    
            # Only save to database if it's a generic second opinion (no custom question)
            if not question:
                self.storage.update_gemini_response(context_id, response)
    
            header = "Gemini's Answer:" if question else "Gemini's Opinion:"
            return [TextContent(type="text", text=f"{header}\n\n{response}")]
        except ValueError as e:
            return [TextContent(type="text", text=f"Error: {e}")]
  • Input schema definition for the 'ask_gemini' tool in list_tools(), specifying context_id (required) and optional question.
    Tool(
        name="ask_gemini",
        description="Ask Google Gemini a question about a context entry, or get a general second opinion",
        inputSchema={
            "type": "object",
            "properties": {
                "context_id": {"type": "string", "description": "Context ID to ask about"},
                "question": {
                    "type": "string",
                    "description": (
                        "Optional specific question to ask about the context. If not provided, gets a general second opinion."
                    ),
                },
            },
            "required": ["context_id"],
        },
    ),
  • Core helper function in GeminiClient that formats the context, sets up system instruction based on whether there's a question, generates content via Gemini API, and returns the response text.
        def get_second_opinion(self, context: ContextEntry, question: str | None = None) -> str:
            """Get Gemini's second opinion on a context, or answer a specific question.
    
            Args:
                context: The context entry to analyze
                question: Optional specific question to ask. If None, provides general second opinion.
            """
            if question:
                # Custom question mode
                system_instruction = """You are a senior software engineering consultant answering questions about code, \
    architecture decisions, and implementation plans.
    
    Provide clear, actionable answers based on the context provided."""
                user_content = self._format_context_for_gemini(context, question)
            else:
                # Generic second opinion mode
                system_instruction = """You are a senior software engineering consultant providing second opinions on code, \
    architecture decisions, and implementation plans.
    
    Your role is to:
    - Provide constructive, balanced feedback
    - Highlight both strengths and potential issues
    - Suggest alternatives when appropriate
    - Point out edge cases or security concerns
    - Be concise but thorough
    
    Format your response clearly with sections as needed."""
                user_content = self._format_context_for_gemini(context)
    
            # Configure model with system instruction
            model_with_instruction = genai.GenerativeModel(self.model_name, system_instruction=system_instruction)
    
            # Use request_options to set timeout
            response = model_with_instruction.generate_content(user_content, request_options={"timeout": self.timeout})
    
            return str(response.text)
  • Helper method that formats the ContextEntry into a string suitable for Gemini prompt, including title, type, content sections, and question or default second opinion request.
    def _format_context_for_gemini(self, context: ContextEntry, question: str | None = None) -> str:
        """Format a context entry for Gemini consumption.
    
        Args:
            context: The context entry to format
            question: Optional specific question to append
        """
        parts = [
            f"# Context: {context.title}",
            f"\n**Type:** {context.type}",
            f"**Timestamp:** {context.timestamp.isoformat()}",
        ]
    
        if context.tags:
            parts.append(f"**Tags:** {', '.join(context.tags)}")
    
        parts.append("\n## Content\n")
    
        # Add specific content based on type
        if context.content.messages:
            parts.append("### Conversation\n")
            for msg in context.content.messages:
                parts.append(msg)
    
        if context.content.code:
            parts.append("### Code\n")
            for file_path, code in context.content.code.items():
                parts.append(f"**File:** `{file_path}`\n```\n{code}\n```\n")
    
        if context.content.suggestions:
            parts.append(f"### Suggestion\n{context.content.suggestions}\n")
    
        if context.content.errors:
            parts.append(f"### Error/Debug Info\n```\n{context.content.errors}\n```\n")
    
        # Add question or default request
        if question:
            parts.append(f"\n---\n**Question:** {question}")
        else:
            parts.append("\n---\nPlease provide a second opinion on the above context.")
    
        return "\n".join(parts)
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 mentions the tool's function but fails to describe key behavioral traits such as response format, potential rate limits, authentication needs, error handling, or whether it's a read-only or mutating operation. For a tool interacting with an external AI service, this lack of detail is a significant gap.

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 extremely concise—a single sentence that efficiently conveys the core functionality without any wasted words. It's front-loaded with the primary purpose and uses clear, straightforward language, making it easy to parse quickly.

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 (interacting with an external AI model) and the lack of annotations and output schema, the description is insufficient. It doesn't explain what a 'general second opinion' entails, how responses are formatted, potential limitations, or error conditions. For a tool with no structured behavioral data, the description should provide more context to ensure reliable agent use.

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 schema description coverage is 100%, with both parameters ('context_id' and 'question') well-documented in the schema. The description adds minimal value beyond the schema by implying that 'question' is optional and that omitting it triggers a 'general second opinion,' but it doesn't provide additional semantics like examples or edge cases. This meets the baseline for high schema coverage.

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: 'Ask Google Gemini a question about a context entry, or get a general second opinion.' It specifies the verb ('ask'), the resource ('Google Gemini'), and the scope ('about a context entry' or 'general second opinion'). However, it doesn't explicitly distinguish this tool from its siblings like 'ask_chatgpt' or 'ask_claude', which appear to serve similar functions with different AI models.

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 guidance on when to use this tool, stating it's for asking questions about a context entry or getting a general second opinion. It doesn't offer explicit alternatives (e.g., when to use 'ask_chatgpt' instead), exclusions, or context-specific prerequisites. The mention of 'general second opinion' is vague and lacks practical usage scenarios.

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/taylorleese/mcp-toolz'

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