Exporting Tools & Docs

You define an action once. From that single contract Ageniti can emit every artifact a consumer needs: MCP tool manifests, LLM tool-call definitions, machine-readable manifests for CI, and human-readable guide docs. Nothing is hand-maintained — the exports are derived from the live action definitions, so they never drift from the implementation.

All examples assume an app or a list of actions:

import { createAgenitiApp } from "@ageniti/core";
 
const app = createAgenitiApp({ name: "task-app", actions, services });

LLM tool-call definitions

One action list, four target formats — import from @ageniti/core/ai-sdk:

import {
  createOpenAITools,
  createOpenAIResponsesTools,
  createAISDKTools,
  createFunctionCallingManifest,
} from "@ageniti/core/ai-sdk";
 
const openai = createOpenAITools(actions);             // OpenAI function calling
const responses = createOpenAIResponsesTools(actions); // OpenAI Responses API
const aiSdk = createAISDKTools(actions, { runtime });  // Vercel AI SDK tools
const generic = createFunctionCallingManifest(actions);// generic tool-call manifest

By default, destructive actions and non-public actions are filtered out of these external tool exports — see Safety for the visibility and side-effect rules.

MCP manifest & server

import { createMcpManifest, createMcpHandler } from "@ageniti/core/mcp";
 
const manifest = createMcpManifest(actions); // { tools: [...] }
const handler = createMcpHandler({ actions, runtime });

From the CLI:

ageniti mcp           # inspect the MCP tool manifest / run the server

Machine-readable manifests

Use these for inspection, custom wrappers, or contract checks in CI — import from @ageniti/core/manifest:

import {
  createActionManifest,
  createSurfaceManifest,
  describeAction,
} from "@ageniti/core/manifest";
 
const actionsManifest = createActionManifest(actions);
const surfaceManifest = createSurfaceManifest({ appName: "task-app", actions });

Or via the app and CLI:

const manifest = app.manifest();          // surface manifest
const actionsOnly = app.actionManifest(); // action contracts only
ageniti manifest      # export the manifest (pipe into tooling / CI)

Human-readable docs

Generate a unified GUIDE.md describing every action — name, description, side effects, visibility, permissions, supported surfaces, when-to-use notes, and input/output examples — from @ageniti/core/docs:

import { createGuideDoc, exportDocs } from "@ageniti/core/docs";
 
const markdown = createGuideDoc({ appName: "task-app", actions });
await exportDocs({ appName: "task-app", actions, outDir: "dist/ageniti" });

Or via the app and CLI:

const markdown = app.createGuideDoc();
await app.exportDocs();
ageniti docs          # print or export the unified guide

Catching contract regressions

Two extras most SDKs do not give you:

  • ageniti diff / diffActionManifests(prev, next) — compares two manifests and reports breaking changes, warnings, and informational changes. Wire it into CI to fail a PR that breaks an action contract.
  • ageniti lint / lintActions(actions) — flags risky action contracts before you ship.
ageniti diff old.json new.json   # detect breaking contract changes
ageniti lint                     # health-check action contracts
import { diffActionManifests } from "@ageniti/core/manifest";
import { lintActions } from "@ageniti/core/lint";
 
const diff = diffActionManifests(previous, next);
if (!diff.ok) throw new Error("Breaking action contract change");

Why this matters

Because every export is derived from the same action definitions, your MCP tools, LLM tool calls, manifests, and docs are always consistent with what the runtime actually does. Add an action once and it shows up — correctly — in every surface and every exported artifact.