Skip to main content
Glama

llm_code

Route coding tasks to the appropriate AI model based on complexity. Generate code, refactor projects, and design algorithms with automatic model selection for simple, moderate, or complex programming needs.

Instructions

Coding task — routes to the best coding model.

Best for: code generation, refactoring suggestions, algorithm design.

Args:
    prompt: The coding task or question.
    complexity: Task complexity — "simple", "moderate", or "complex". Drives model
        selection: simple questions use Haiku/Flash, actual implementation tasks use
        Sonnet/GPT-4o, large refactors or architecture work use Opus/o3.
    system_prompt: Optional system instructions (language, framework, style).
    max_tokens: Maximum output tokens.
    context: Optional conversation context to help the model understand the broader task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes
complexityNo
system_promptNo
max_tokensNo
contextNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries full behavioral burden and excels at explaining the internal model routing logic—specifically mapping complexity levels to specific model tiers (Haiku/Flash for simple, Sonnet/GPT-4o for implementation, Opus/o3 for architecture). It could further improve by mentioning error handling or retry behavior.

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?

The description is well-structured with clear sections: a one-line summary, a 'Best for' usage statement, and an Args block with detailed parameter explanations. Every sentence adds value, particularly the model routing details which are essential for proper complexity selection.

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

Completeness4/5

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

Given the 5 parameters with zero schema descriptions and lack of annotations, the description provides sufficient context for invocation. Since an output schema exists, the description appropriately omits return value details. It could reach 5 by explicitly contrasting with the similar 'llm_codex' sibling tool.

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

Parameters5/5

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

The schema has 0% description coverage (titles only), and the description comprehensively compensates by documenting all 5 parameters. It adds crucial semantic meaning to the 'complexity' enum values (explaining exactly which models are selected for each tier) and clarifies the purpose of optional fields like 'system_prompt' and 'context'.

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 clearly states the tool routes coding tasks to appropriate models and lists specific use cases (code generation, refactoring, algorithm design). However, with siblings like 'llm_codex' and 'llm_edit', it could more explicitly differentiate its specific routing purpose from other coding-related tools.

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?

The 'Best for' section provides clear positive guidance on when to use the tool (coding tasks). However, it lacks explicit guidance on when NOT to use it or which sibling tools (e.g., 'llm_generate', 'llm_codex') should be preferred for non-coding or specific coding scenarios.

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/ypollak2/llm-router'

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