Skip to main content
Glama

ollama_explain_code

Explain how a code section, algorithm, or pattern works using a local Ollama model. Add context to get targeted explanations of complex code.

Instructions

Explain how code works using Ollama. Use this to understand complex code sections, algorithms, or 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": {
      "code": "<code>"
    },
    "name": "ollama_explain_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe code to explain
modelNoOllama model to use (default: mistral-small)gemma3:12b
contextNoAdditional context about what you want to understand

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/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 and covers very little: nothing about requiring a running local Ollama server, model availability, latency/cost, or whether output is free-form prose versus structured findings. 'Using Ollama' is the only behavioral hint, which is thin for an LLM-backed tool.

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, purpose front-loaded, zero filler. It is efficient but correspondingly sparse, leaving no structure for usage or behavioral caveats.

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?

A simple three-parameter tool with full schema coverage and no output schema needs less prose, but the description still omits what comes back (a textual explanation) and the operational prerequisite of a local Ollama instance, which matters for a tool that can fail purely on environment grounds.

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 parameters (code, model, context) are already documented in the schema and the baseline is 3. The description adds no meaning about how `context` should be phrased or how model choice affects results, and it does not address the schema's internal inconsistency where `model` is documented as defaulting to gemma3:12b but labelled '(default: mistral-small)'.

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 ('Explain how code works using Ollama') plus the kinds of input it targets (complex sections, algorithms, patterns). It never distinguishes itself from close siblings such as ollama_explain_file or ollama_review_code, so an agent facing a code snippet inside a file must guess.

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?

'Use this to understand complex code sections, algorithms, or patterns' gives a genuine when-to-use signal, but there are no exclusions and no named alternatives, so the boundary against explain_file / review_code / refactor_code remains implicit.

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