Skip to main content
Glama
emgeee

MCP Ollama Server

ask_model

Ask questions to Ollama AI models through the MCP server to get responses and insights.

Instructions

Ask a question to a specific Ollama model

Args:
    model: Name of the model to use (e.g., 'llama2')
    question: The question to ask the model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYes
questionYes

Implementation Reference

  • The main handler function for the 'ask_model' tool. It is decorated with @mcp.tool() which registers it in the MCP server. The function takes a model name and question, sends a chat request to Ollama, and returns the response content. Includes input schema via type hints and docstring.
    @mcp.tool()
    async def ask_model(model: str, question: str) -> str:
        """Ask a question to a specific Ollama model
    
        Args:
            model: Name of the model to use (e.g., 'llama2')
            question: The question to ask the model
        """
        try:
            response = ollama.chat(
                model=model,
                messages=[{
                    'role': 'user',
                    'content': question
                }]
            )
            return response['message']['content']
        except Exception as e:
            return f"Error querying model: {str(e)}"
  • The @mcp.tool() decorator registers the ask_model function as an MCP tool.
    @mcp.tool()
  • The function signature and docstring define the input schema (model: str, question: str) and output (str).
    async def ask_model(model: str, question: str) -> str:
        """Ask a question to a specific Ollama model
    
        Args:
            model: Name of the model to use (e.g., 'llama2')
            question: The question to ask the model
        """
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the basic action but doesn't cover critical traits like response format, potential latency, error handling, or any limitations (e.g., token limits, model availability). This leaves significant gaps in understanding how the tool behaves beyond its core function.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, with the first sentence clearly stating the purpose. The 'Args' section is structured but could be more integrated; overall, it avoids unnecessary verbosity. A point is deducted because the formatting (e.g., bullet-like 'Args:') slightly disrupts flow, but it remains efficient.

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 complexity of querying an AI model, no annotations, and no output schema, the description is incomplete. It lacks details on response behavior, error cases, and operational constraints, which are essential for effective tool use. The agent would need to guess or trial-and-error to understand full context, making this inadequate for a tool with such potential variability.

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?

Schema description coverage is 0%, so the description must compensate. It adds value by explaining the 'model' parameter with an example ('e.g., llama2') and clarifying 'question' as the input to ask, which goes beyond the bare schema. However, it doesn't detail constraints (e.g., model naming conventions, question length limits), resulting in a baseline score that reflects partial compensation.

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 action ('Ask a question') and the target resource ('to a specific Ollama model'), making the purpose immediately understandable. It distinguishes from siblings like 'list_models' and 'show_model' by focusing on querying rather than listing or displaying model details. However, it doesn't specify the exact nature of the response (e.g., text generation, reasoning), keeping it from a perfect score.

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?

No explicit guidance is provided on when to use this tool versus alternatives. While the description implies usage for querying models, it doesn't mention prerequisites (e.g., model must be available), exclusions, or comparisons to other tools. The agent must infer usage from the purpose alone, lacking clear contextual direction.

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/emgeee/mcp-ollama'

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