@reforma/plugin-sdk
v0.1.2
Published
Authoring SDK for Reforma catalog plugin tools.
Readme
@reforma/plugin-sdk
Write a tool as the default export of a file under tools/. Import defineTool and z from this package. Tool name = filename (Grep.ts → Grep). Pack bundles them into one tools.mjs (export default { Grep, … }); the host imports that map and reads override on each tool object.
import { defineTool, z } from "@reforma/plugin-sdk";
export default defineTool({
description: "Search the workspace.",
inputSchema: z.object({ pattern: z.string() }),
// override: true, // bare name, no plugin prefix — shadows same-named tools
async execute({ pattern }, ctx) {
// ctx.pluginDir, ctx.env, ctx.toolName, ctx.toolCallId, ctx.abortSignal
return { pattern };
},
});| Field | Notes |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| description | Required. |
| inputSchema | Zod schema (z re-exported). |
| execute(input, ctx) | ctx: toolName, pluginDir, env, toolCallId, abortSignal. |
| override | Optional. Bare filename name; shadows same-named tools. |
| Pass-through | outputSchema, toModelOutput, providerOptions, strict, inputExamples, needsApproval, onInputStart / onInputDelta / onInputAvailable, … |
npm install @reforma/plugin-sdk zod