Exports
definePlugin(config): Plugin
Creates a plugin with a manifest and handler registry.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique plugin identifier |
name | string | Yes | Human-readable name |
description | string | Yes | Plugin description |
authProviders | AuthProvider[] | Yes | Authentication providers |
tools | ToolConfig[] | Yes | Tool definitions |
Plugin object with:
manifest— serializedPluginManifest(Zod schemas converted to JSON Schema)handlers—Map<string, handler>keyed by tool path
Handlers are wrapped with Zod parsing.
definePlugin doesn’t store the handler reference verbatim — it wraps it in (ctx, input) => handler(ctx, tool.inputSchema.parse(input ?? {})). This means schema defaults are applied before your handler sees the input, and invalid input throws a Zod error before any side effects. If you write inputSchema: z.object({ calendarId: z.string().default("primary") }) and the caller omits calendarId, your handler reads "primary", not undefined. Tests that compare handler references for equality won’t work — invoke through the wrapper.defineTool(config): ToolConfig
Type-safe wrapper for tool definitions. Returns the config as-is with proper generic inference.
defineSource(config): SourceConfig
Type-safe wrapper for source configurations. Returns the config as-is.
elicit(ctx, request): Promise<ElicitationResponse>
Convenience wrapper for requesting user approval. Equivalent to calling ctx.elicit(request) directly.
SourceConfigSchema
Zod discriminated union schema for validating source configurations. Validates openapi, graphql, mcp, and plugin source types.
Type exports
Plugin, PluginConfig, ToolConfig, Source, SourceAdapter, SourceConfig, SourceAuth, OpenAPISourceConfig, MCPSourceConfig, GraphQLSourceConfig, PluginSourceConfig