Skip to main content
Glama

get-macro-info

Retrieve documentation for Macroforge macros and decorators, including descriptions, options, and configuration details for development.

Instructions

Get documentation for Macroforge macros and decorators.

Returns information about:

  • Macro descriptions (e.g., Debug, Serialize, Clone)

  • Decorator documentation (e.g., @serde, @debug field decorators)

  • Available macro options and configuration

Use without parameters to get the full manifest of all available macros and decorators. Use with a name parameter to get info for a specific macro or decorator.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoOptional: specific macro or decorator name to look up

Implementation Reference

  • The main handler function that implements the 'get-macro-info' tool logic. It dynamically imports the native Macroforge module, retrieves the macro manifest, and formats documentation for either all macros/decorators or a specific one based on the input.
     * Handles the `get-macro-info` tool call.
     *
     * Retrieves documentation for Macroforge macros and field decorators from the
     * native manifest. Can return info for a specific macro/decorator or the full
     * manifest of all available macros and decorators.
     *
     * ## Usage Modes
     *
     * - **Without name**: Returns full manifest with all macros and decorators
     * - **With name**: Returns detailed info for the specific macro or decorator
     *
     * ## Manifest Contents
     *
     * - **Macros**: @derive decorators like Debug, Serialize, Clone
     * - **Decorators**: Field decorators like @serde.skip, @serde.rename
     *
     * @param args - Tool arguments
     * @param args.name - Optional macro or decorator name to look up
     * @returns MCP response with formatted macro/decorator documentation
     */
    async function handleGetMacroInfo(args: { name?: string }) {
      try {
        const macroforge = await importMacroforge();
    
        if (!macroforge || !macroforge.__macroforgeGetManifest) {
          return {
            content: [
              {
                type: 'text' as const,
                text: 'Native Macroforge bindings not available. Install @macroforge/core to access macro documentation.',
              },
            ],
          };
        }
    
        const manifest = macroforge.__macroforgeGetManifest();
    
        if (args.name) {
          // Look up specific macro or decorator
          const nameLower = args.name.toLowerCase();
          const macro = manifest.macros.find(m => m.name.toLowerCase() === nameLower);
          const decorator = manifest.decorators.find(d => d.export.toLowerCase() === nameLower);
    
          if (!macro && !decorator) {
            return {
              content: [
                {
                  type: 'text' as const,
                  text: `No macro or decorator found with name "${args.name}".
    
    Available macros: ${manifest.macros.map(m => m.name).join(', ')}
    Available decorators: ${manifest.decorators.map(d => d.export).join(', ')}`,
                },
              ],
            };
          }
    
          let result = '';
    
          if (macro) {
            result += `## Macro: @derive(${macro.name})\n\n`;
            result += `**Description:** ${macro.description || 'No description available'}\n`;
            result += `**Kind:** ${macro.kind}\n`;
            result += `**Package:** ${macro.package}\n`;
          }
    
          if (decorator) {
            if (result) result += '\n---\n\n';
            result += `## Decorator: @${decorator.export}\n\n`;
            result += `**Documentation:** ${decorator.docs || 'No documentation available'}\n`;
            result += `**Kind:** ${decorator.kind}\n`;
            result += `**Module:** ${decorator.module}\n`;
          }
    
          return {
            content: [{ type: 'text' as const, text: result }],
          };
        }
    
        // Return full manifest
        let result = '# Macroforge Macro Manifest\n\n';
    
        result += '## Available Macros\n\n';
        for (const macro of manifest.macros) {
          result += `### @derive(${macro.name})\n`;
          result += `${macro.description || 'No description'}\n\n`;
        }
    
        if (manifest.decorators.length > 0) {
          result += '## Available Field Decorators\n\n';
          for (const decorator of manifest.decorators) {
            result += `### @${decorator.export}\n`;
            result += `${decorator.docs || 'No documentation'}\n\n`;
          }
        }
    
        return {
          content: [{ type: 'text' as const, text: result }],
        };
      } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: 'text' as const,
              text: `Error getting macro info: ${message}`,
            },
          ],
        };
      }
    }
  • Tool registration in the MCP tools/list handler, defining the name, description, and input schema for 'get-macro-info'.
            {
              name: 'get-macro-info',
              description: `Get documentation for Macroforge macros and decorators.
    
    Returns information about:
    - Macro descriptions (e.g., Debug, Serialize, Clone)
    - Decorator documentation (e.g., @serde, @debug field decorators)
    - Available macro options and configuration
    
    Use without parameters to get the full manifest of all available macros and decorators.
    Use with a name parameter to get info for a specific macro or decorator.`,
              inputSchema: {
                type: 'object',
                properties: {
                  name: {
                    type: 'string',
                    description: 'Optional: specific macro or decorator name to look up',
                  },
                },
              },
            },
  • Input schema definition for the 'get-macro-info' tool, specifying an optional 'name' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        name: {
          type: 'string',
          description: 'Optional: specific macro or decorator name to look up',
        },
      },
    },
  • Dispatch case in the MCP tools/call handler that routes 'get-macro-info' requests to the handler function.
    case 'get-macro-info':
      return handleGetMacroInfo(args as { name?: string });
  • Helper function used by the handler to dynamically load the optional @macroforge/core native bindings.
    async function importMacroforge(): Promise<MacroforgeModule | null> {
      try {
        // Dynamic import to avoid build-time errors when @macroforge/core is not installed
        // @ts-expect-error - dynamic import of optional dependency
        const mod = await import('@macroforge/core');
        return mod as MacroforgeModule;
      } catch {
        // Package not installed - return null to indicate unavailability
        return null;
      }
Behavior3/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes what the tool returns (information about macros, decorators, options) and the two usage modes, but it lacks details on potential side effects, error handling, rate limits, or authentication needs. For a read-only tool, this is adequate but minimal, as it doesn't fully compensate for the absence of annotations.

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 concise, with no wasted words. It starts with the core purpose, lists what information is returned, and provides clear usage instructions in two bullet points. Every sentence adds value, and it is front-loaded with essential information, making it easy to understand quickly.

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?

Given the tool's complexity (simple read operation with one optional parameter) and the absence of annotations and output schema, the description is moderately complete. It explains what the tool does and how to use it, but it doesn't detail the return format, error cases, or how it differs from sibling tools. For a tool without output schema, more information on return values would be beneficial, but it's adequate for basic use.

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, with the 'name' parameter documented as 'Optional: specific macro or decorator name to look up.' The description adds value by explaining the semantics: using no parameters returns a full manifest, while using the name parameter retrieves specific info. However, it doesn't provide additional details beyond what the schema already covers, such as format examples or constraints, so it meets the baseline for high schema coverage.

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's purpose: 'Get documentation for Macroforge macros and decorators.' It specifies the resource (macros and decorators) and verb (get documentation), making the intent unambiguous. However, it does not explicitly differentiate from sibling tools like 'get-documentation' or 'list-sections,' which might have overlapping purposes, so it falls short of a perfect score.

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 usage guidance: 'Use without parameters to get the full manifest... Use with a name parameter to get info for a specific macro or decorator.' This explains when to use each mode, but it does not mention when to choose this tool over alternatives like 'get-documentation' or 'list-sections,' nor does it specify any prerequisites or exclusions, so it's not fully comprehensive.

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