Skip to main content
Glama

expand-code

Expands TypeScript macros and @derive decorators to show generated code with diagnostics for debugging and understanding transformations.

Instructions

Expands Macroforge macros in TypeScript code and returns the transformed result.

Shows:

  • The fully expanded TypeScript code with all generated methods

  • Any diagnostics (errors, warnings, info) with line/column locations

  • Help text for fixing issues (when available)

Useful for:

  • Seeing what code the macros generate

  • Understanding how @derive decorators transform your classes

  • Debugging macro expansion issues

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesTypeScript code with @derive decorators to expand
filenameNoFilename for the code (default: input.ts)
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what the tool returns (expanded code, diagnostics, help text) and its purpose for debugging, but lacks details on error handling, performance implications, or any side effects. It does not contradict annotations, but could benefit from more behavioral context like rate limits or memory usage.

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 and front-loaded with the core purpose in the first sentence. Each subsequent section ('Shows:', 'Useful for:') adds value without redundancy, and the bullet points are concise. There is no wasted text, making it efficient for an AI agent to parse.

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 tool's complexity (transforming code with diagnostics) and no output schema, the description does a good job explaining the return values (expanded code, diagnostics, help text). However, it could be more complete by mentioning potential limitations or edge cases, such as handling invalid input or the scope of macro expansion. With no annotations, it adequately covers the tool's purpose and output but leaves some behavioral gaps.

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?

The input schema has 100% description coverage, clearly documenting both parameters ('code' and 'filename'). The description does not add any additional semantic details beyond what the schema provides, such as explaining the format of 'code' or when 'filename' is necessary. Baseline score of 3 is appropriate as the schema does the heavy lifting.

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 clearly states the specific action ('Expands Macroforge macros in TypeScript code') and resource ('TypeScript code'), distinguishing it from siblings like 'get-documentation' or 'get-macro-info' by focusing on transformation rather than information retrieval. It explicitly mentions the output ('returns the transformed result') and the context of @derive decorators.

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?

The description provides clear context for when to use this tool ('Useful for: Seeing what code the macros generate, Understanding how @derive decorators transform your classes, Debugging macro expansion issues'), which helps differentiate it from siblings. However, it does not explicitly state when not to use it or name specific alternatives, such as when to prefer 'macroforge-autofixer' for fixing issues instead of just expanding.

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/macroforge-ts/mcp-server'

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