Skip to main content
Glama

generate_code

Generate new code from natural-language instructions using a local Ollama model. Optionally provide a context file to guide style and API usage.

Instructions

Generate new code from a natural-language instruction using the local Ollama model.

Pass context_file (a server-side path) instead of pasting an existing file's contents to give the model style/API context without spending your own context window on it. Set think=False for faster, simpler generations; leave think=True for anything non-trivial.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thinkNo
languageNo
instructionYes
context_fileNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

Mentions use of local Ollama model and server-side path for context_file, but does not disclose important behavioral traits such as file creation, network calls, or model limitations. No annotations present to supplement.

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

Conciseness5/5

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

Every sentence is purposeful and provides actionable guidance. Information is front-loaded, with efficient use of words.

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?

Covers key parameter usage but omits output mechanism (e.g., where generated code is returned or saved). Output schema exists but description does not mention it, leaving the return format unclear.

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?

Adds meaning to 'think' (speed vs completeness) and 'context_file' (server-side path for context), but does not explain 'language' parameter at all, leaving it ambiguous despite being optional.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states it generates new code from natural-language instructions using a local Ollama model, differentiating it from sibling tools like 'review_code' or 'fix_code' which operate on existing code.

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?

Provides clear advice on when to set 'think' to False vs True and how to use 'context_file' to preserve context window, but does not compare with sibling tools to guide selection.

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

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