Tools
Author one TypeScript tool module and generate harness glue around it.
On this page
Tools let you keep real implementation code in one tools.ts module. The build copies the module into every output and generates the glue each harness needs: MCP server wiring for Claude/Codex and native tool/plugin glue for Pi/OpenCode.
tools.ts
import { defineTool } from "@jalco/ap-sdk/runtime";
export default [
defineTool({
name: "echo",
description: "Echo text back for smoke tests.",
inputSchema: { type: "object", properties: { text: { type: "string" } }, required: ["text"] },
async execute(input: { text: string }) {
return { content: [{ type: "text", text: input.text }] };
},
}),
];plugin.ts
import { definePlugin } from "@jalco/ap-sdk";
export default definePlugin({
id: "echo-tool",
description: "Tool smoke test.",
tools: { module: "./tools.ts", names: ["echo"] },
});Local loop
ap-sdk tools --call echo --args '{"text":"hello"}'Fields
tools.modulepoints at the TypeScript module.tools.nameslimits or documents the exported tools.defineTooldescribes the name, description, input schema, and execute function.
See packages/agent-plugin-sdk/examples/echo-tool/ and examples/planreview/ for working projects. Next: instructions and files and the support matrix.
On this page