Skip to main content
Glama
codedrop-codes

Refactory

refactory_verify_exports

Compare a post-decomposition module against a golden export snapshot to detect missing, added, or type-changed exports.

Instructions

Compare post-decomposition module against golden export snapshot. Reports missing, added, or type-changed exports.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
goldenFileYesPath to .golden-exports.json from characterize
newFileYesPath to the new re-export module

Implementation Reference

  • src/server.js:142-152 (registration)
    Tool 'refactory_verify_exports' registered in the TOOLS array with name, description, and inputSchema (goldenFile + newFile required).
      name: "refactory_verify_exports",
      description: "Compare post-decomposition module against golden export snapshot. Reports missing, added, or type-changed exports.",
      inputSchema: {
        type: "object",
        properties: {
          goldenFile: { type: "string", description: "Path to .golden-exports.json from characterize" },
          newFile: { type: "string", description: "Path to the new re-export module" },
        },
        required: ["goldenFile", "newFile"],
      },
    },
  • The verifyExports function is the handler for refactory_verify_exports. It loads golden exports JSON and the new module, then compares exports reporting missing, added, and type-changed exports.
    function verifyExports({ goldenFile, newFile }) {
      const absGolden = path.resolve(goldenFile);
      const absNew = path.resolve(newFile);
    
      if (!fs.existsSync(absGolden)) {
        throw new Error(`Golden file not found: ${absGolden}`);
      }
      if (!fs.existsSync(absNew)) {
        throw new Error(`New module not found: ${absNew}`);
      }
    
      const golden = JSON.parse(fs.readFileSync(absGolden, "utf8"));
      const mod = freshRequire(absNew);
      const current = captureExports(mod);
    
      const goldenNames = Object.keys(golden.exports);
      const currentNames = Object.keys(current);
    
      const missing = goldenNames.filter((n) => !(n in current));
      const added = currentNames.filter((n) => !(n in golden.exports));
      const typeChanged = goldenNames.filter(
        (n) => n in current && current[n] !== golden.exports[n]
      );
    
      const matches = missing.length === 0 && added.length === 0 && typeChanged.length === 0;
      return { matches, missing, added, typeChanged };
    }
  • Dispatch case in server.js: when tool name is 'refactory_verify_exports', calls verifyExports(args) synchronously.
    case "refactory_verify_exports": result = verifyExports(args); break;
  • Input schema for refactory_verify_exports: requires goldenFile (string) and newFile (string).
      inputSchema: {
        type: "object",
        properties: {
          goldenFile: { type: "string", description: "Path to .golden-exports.json from characterize" },
          newFile: { type: "string", description: "Path to the new re-export module" },
        },
        required: ["goldenFile", "newFile"],
      },
    },
  • CaptureExports helper maps every export key to its typeof string. Also freshRequire helper to load module without cache for re-checking.
    function captureExports(mod) {
      const result = {};
      if (mod == null) return result;
    
      // If the module is a plain function (module.exports = fn), record as "default"
      if (typeof mod === "function") {
        result["default"] = "function";
        // Also capture any properties attached to the function
        for (const key of Object.keys(mod)) {
          result[key] = typeof mod[key];
        }
        return result;
      }
    
      if (typeof mod !== "object") {
        result["default"] = typeof mod;
        return result;
      }
    
      for (const key of Object.keys(mod)) {
        result[key] = typeof mod[key];
      }
      return result;
    }
Behavior2/5

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

With no annotations, the description carries full burden for behavioral disclosure. It describes the output (reports missing/added/type-changed exports) but does not clarify whether the tool is read-only, what permissions are needed, or error conditions. The name and schema do not compensate for this lack of transparency.

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?

Two sentences, directly to the point. No unnecessary words. The most important information (what it does and what it reports) is front-loaded.

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 simplicity (two parameters, no output schema), the description provides a reasonable overview. It could mention the output format or relationship to refactory_verify, but is largely adequate for a focused comparison tool.

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?

Schema description coverage is 100%, so the schema already documents both parameters adequately. The description adds no extra meaning beyond the schema's field descriptions. Baseline score of 3 is appropriate.

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 tool compares a post-decomposition module against a golden export snapshot and reports specific differences (missing, added, type-changed exports). This distinguishes it from sibling tools like refactory_characterize or refactory_decompose by its specific focus on export verification.

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 description implies usage after decomposition ('post-decomposition module') but does not explicitly state when to use this tool versus alternatives such as refactory_verify or refactory_analyze. No 'when-not-to-use' guidance or alternative tool references are provided.

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/codedrop-codes/refactory'

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