Skip to main content
Glama

ollama_generate_code

Generate new functions, classes, or code snippets with local Ollama models by supplying a detailed prompt and target programming language.

Instructions

Generate code using Ollama. Use this for writing new functions, classes, or code snippets. Provide detailed requirements and context.

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"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoOllama model to use (default: mistral-small)gemma3:12b
promptYesDetailed description of the code to generate, including requirements, language, and context
languageYesProgramming language (e.g., javascript, python, rust)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden. It advises providing detailed requirements and context, but does not disclose return format, whether files are modified, model selection behavior, or limitations, leaving important behavioral expectations unspecified.

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 short, front-loaded with the core purpose, and structured as purpose followed by use case and input guidance. It contains no filler, though the input guidance is generic.

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

Completeness3/5

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

The tool has three parameters with full schema coverage, but no output schema and no annotations. The description covers the basic purpose and input expectation, but it omits return behavior and any distinction from the closely named context-aware generation sibling.

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 100%, so the input schema already documents all three parameters. The description adds only a general instruction to provide detailed requirements and context, which largely restates the prompt parameter and does not clarify model or language semantics beyond the schema.

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 states a specific verb and resource: generating code with Ollama, and narrows the use case to writing new functions, classes, or snippets. It distinguishes the purpose from explain/fix/review siblings implicitly, but does not explicitly name the closest alternative, ollama_generate_code_with_context.

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

Usage Guidelines4/5

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

It gives a clear when-to-use statement: writing new functions, classes, or code snippets. However, it offers no when-not-to-use guidance and does not route the agent to alternatives such as the context-aware generation variant or write_tests.

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