Skip to main content
Glama

ollama_refactor_code

Refactors code to improve readability, quality, or structure using Ollama models, helping reduce complexity and modernize syntax based on a specified goal.

Instructions

Refactor code to improve quality, readability, or structure using Ollama.

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>",
      "goal": "<goal>"
    },
    "name": "ollama_refactor_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe code to refactor
goalYesRefactoring goal (e.g., 'improve readability', 'reduce complexity', 'modernize syntax')
modelNoOllama model to use (default: mistral-small)gemma3:12b

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 supplied, so the description carries the full disclosure burden. It states that Ollama is the engine but says nothing about whether behavior is preserved, how long a local model call takes, what happens on model failure, or what the response contains (refactored code versus commentary). For a model-invocation tool with zero annotation coverage, this is a substantial gap.

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?

A single well-formed sentence with no filler, and the core action is front-loaded. It is not padded, though it is perhaps too terse for the amount of behavioral context an unannotated LLM-backed tool needs.

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?

With three simple flat parameters and no output schema, the definition is minimally adequate, but it omits both the routing guidance against sibling tools and any indication of the return shape. An agent could call it correctly but might pick the wrong sibling or mis-handle the response.

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 all three parameters (code, goal, model) are already documented in the schema, and the description adds no syntax or format detail beyond that. Baseline 3 applies. Note that the schema itself is internally inconsistent on the default model ('gemma3:12b' versus '(default: mistral-small)'), though this is a schema issue rather than a description flaw.

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 pairs a specific verb ('Refactor') with a concrete resource ('code') and names the dimensions of improvement (quality, readability, structure), so an agent knows it restructures existing code rather than producing new code. It stops short of differentiating itself from close siblings such as ollama_fix_code or ollama_generate_code, so a 4 rather than a 5.

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?

There is no explicit when-to-use or when-not-to-use guidance, and no alternative is named. The only routing signal is the word 'refactor', which implicitly contrasts with fixing or generating, but the agent must infer that from the verb alone and could easily mis-select against ollama_fix_code.

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