Skip to main content
Glama

local_draft_leaf_code

Draft a standalone leaf file such as a unit test, schema, DTO, or boilerplate using the local GPU LLM with zero cloud quota, then validate and write it to disk with automatic cloud escalation if drafting fails.

Instructions

Draft standalone leaf-node boilerplate, unit test files, DTOs, or schemas on disk using the Local GPU LLM (0x cloud quota). Reads reference_files on the server side, validates that the drafted code is >=15 chars with closed markdown fences and no truncation placeholders before writing target_file (automatically aborting disk write and escalating to agy_delegate_edit flash-high if invalid or offline). WHEN TO USE: Creating or updating a single self-contained leaf file (unit tests, schemas, types, boilerplate). DO NOT USE FOR: Complex multi-file refactoring or cross-module architectural edits (use agy_delegate_edit instead). RETURNS: Write confirmation, byte/line counts, and git diff --stat summary.

Input Schema

NameRequiredDescriptionDefault
cwdNoOptional working directory path (defaults to workspace root).
specYesDetailed specification of the leaf code, boilerplate, schema, or unit test cases to generate.
target_fileYesRelative or absolute path to the single leaf file to create or update on disk.
reference_filesYesList of existing file paths to read from disk on the server side as style, type, and import references.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv1.2.1
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / cwd / description
      Previous value: -"Optional working directory (defaults to workspace root)."New value: +"Optional working directory path (defaults to workspace root)."
    • changedInput schema / properties / reference_files / description
      Previous value: -"List of existing file paths to read from disk as style/type/import references."New value: +"List of existing file paths to read from disk on the server side as style, type, and import references."
    • changedInput schema / properties / spec / description
      Previous value: -"Detailed specification of the leaf code, boilerplate, schema, or test cases to generate."New value: +"Detailed specification of the leaf code, boilerplate, schema, or unit test cases to generate."
    • addedInput schema / properties / spec / minLength
      Added value: +1
    • changedInput schema / properties / target_file / description
      Previous value: -"Path to the file to create or update on disk."New value: +"Relative or absolute path to the single leaf file to create or update on disk."
    • addedInput schema / properties / target_file / minLength
      Added value: +1
  2. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing validation gates (>=15 chars, closed markdown fences, no truncation placeholders), the automatic abort of the disk write, the offline fallback to agy_delegate_edit, and the server-side reading of reference_files. annotations only supply generic hints (readOnly=false, destructive=false, not idempotent), so this added detail is exactly the value the description should provide.

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?

Front-loaded with the action sentence, then clearly delineated WHEN TO USE / DO NOT USE FOR / RETURNS blocks. Dense but every clause carries operational information; nothing is redundant with the schema or annotations.

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

Completeness5/5

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

For a single-file write tool with 4 params and no output schema, the description covers the return payload (write confirmation, byte/line counts, git diff --stat), failure handling, and escalation. Nothing an agent needs to call it safely is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: it clarifies that reference_files are read server-side as style/type/import references and that target_file is written automatically only after validation passes. It doesn't clarify cwd semantics or overwrite behavior for an existing target_file, which keeps it from a 5.

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?

States a specific verb ('Draft') plus concrete artifact types (leaf-node boilerplate, unit tests, DTOs, schemas) and the execution backend (Local GPU LLM). It explicitly names the sibling it is not (agy_delegate_edit for multi-file work), so an agent can separate it from its siblings without opening a schema.

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

Usage Guidelines5/5

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

Contains explicit WHEN TO USE ('single self-contained leaf file') and DO NOT USE FOR ('complex multi-file refactoring or cross-module architectural edits') with the correct alternative named. The escalation path to agy_delegate_edit flash-high on failure is also spelled out.

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