Skip to main content
Glama

ollama_generate_code_with_context

Generate code using local Ollama models with context from existing files to match project patterns.

Instructions

Generate code using Ollama with context from existing files. Reads reference files to understand patterns.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "prompt": "<prompt>",
      "language": "<language>"
    },
    "name": "ollama_generate_code_with_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoOllama model to use (default: gemma3:27b)gemma3:12b
promptYesDetailed description of the code to generate
languageYesProgramming language (e.g., javascript, python, rust)
context_filesNoArray of file paths to use as context/examples

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
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. It discloses only that reference files are read; it says nothing about that read being filesystem access, about model invocation cost/latency, about behavior when context_files are missing or exceed limits, or about the shape of the returned code.

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?

Two short sentences, front-loaded with the core action; the second sentence adds the differentiating detail. Nothing is padded, though the very brevity leaves the definition underspecified.

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?

For a 4-parameter generative tool with no annotations and no output schema, the description is too thin: it does not describe what comes back (raw code, fenced block, prose), how much context is consumed, or when the call will fail, all of which an agent needs to plan the call.

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

Parameters2/5

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

Schema coverage is 100%, so the description need not repeat parameter docs, and it adds nothing for prompt, language, or context_files. Worse, it conflicts with the schema: it says "(default: gemma3:27b)" while the schema declares default "gemma3:12b", which could lead an agent to make a wrong assumption about the active model.

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?

States a specific verb and resource ("Generate code using Ollama") and distinguishes itself from the plain generation sibling by adding "with context from existing files". A reader can tell it apart from ollama_generate_code, though not from ollama_refactor_code or ollama_write_tests.

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

Usage Guidelines3/5

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

Implies the selection condition (use this when you want existing files consulted as examples), but never says so explicitly, never names an alternative, and gives no prerequisites such as whether the files must exist or be readable.

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