Skip to main content
Glama

Scaffold Code Block

scaffold_code_block
Read-onlyIdempotent

Generate correctly formatted Xojo #tag blocks for methods, properties, constants, and event handlers instead of writing IDE syntax from memory. Returns text to insert before linting.

Instructions

Generates a correctly formatted #tag block for a .xojo_code or .xojo_window file: a method, shared method, property, constant, event definition (#tag Hook), control event handler (#tag Events block) or window event handler. Use it instead of writing #tag syntax from memory when editing a project file on disk: it pairs each Flags value with its visibility keyword, escapes a constant's Default value, and indents the body the way the IDE does. It only returns text; insert it yourself, in the block order usage-guide.md's Format Rules give and before #tag ViewBehavior, then check the file with lint_project_file. A control_event result is a whole #tag Events block: if the control already has one, insert just its inner #tag Event … #tag EndEvent. An argument that does not apply to block_kind, a name that is not a Xojo identifier, or a constant value it cannot escape safely is an error. Reads no files and needs no IDE.

Input Schema

NameRequiredDescriptionDefault
bodyNoCode for a method or event handler, one statement per line; indent nested blocks with two spaces. Omit for an empty body
nameYesThe member's name; for control_event, the control's name (e.g. Button1); for window_event, the event's name (e.g. Opening)
typeNoproperty: its data type (required). constant: String, Integer, Double, Boolean or Color (default String)
eventNocontrol_event only: the event's name, e.g. Pressed
signatureNoParameter list and optional return type, e.g. '(count As Integer) As String'. A return type makes it a Function. Defaults to '()'
block_kindYesmethod, shared_method, property, constant, event_definition, control_event, or window_event
visibilityNopublic, protected or private (method, shared_method, property, constant); default public. In a module, public means global
default_valueNoconstant only: the raw, unescaped value; this tool escapes it

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true, so the safety profile is known, but the description still adds real behavioral detail beyond them: the tool writes nothing and must be followed by manual insertion, it normalizes visibility keywords against Flags, escapes the constant's Default value, and applies IDE-style indentation. It also defines failure modes (inapplicable argument for block_kind, non-identifier name, unescapable constant value), which no annotation covers.

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?

Front-loaded with the purpose and the block-kind enumeration before the procedural insertion guidance, so an agent can stop reading early. It is dense rather than padded, though the clause about usage-guide.md Format Rules and placement before #tag ViewBehavior adds length that a pointer could have compressed.

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?

With no output schema, the description carries the return-value burden, and it does so by stating the result is text only and describing what a control_event result contains. It stops short of showing the returned block's shape (headers, Flags line layout) or noting whether the text includes surrounding delimiters, which is the remaining gap for a text-generating tool.

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 would be 3; the description adds cross-parameter semantics the schema cannot express — that control_event yields an entire #tag Events block, and that only its inner Event/EndEvent portion should be pasted when one already exists, plus the general rule that arguments not applying to block_kind are errors. The individual per-parameter meanings still live in the schema rather than the description, keeping it below 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?

The description gives a specific verb ("Generates") plus a precisely enumerated resource: a #tag block for a .xojo_code or .xojo_window file, with the seven supported block kinds listed inline. An agent can distinguish it from siblings like edit_code or set_code because it is explicitly a text-generating, no-side-effect scaffolder rather than a file mutator.

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?

It states the use case explicitly (use instead of writing #tag syntax from memory when editing a project file on disk) and names the follow-up sibling, lint_project_file, for verification. It also states the exclusions: it only returns text, the caller must insert it, and it reads no files and needs no IDE — leaving nothing about when-to-use to inference.

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