Skip to main content

Type Alias: GatedToolDef

GatedToolDef = object

Defined in: createGatedToolRegistrar.ts:28

Definition for a single gated tool.

Properties​

_meta?​

optional _meta?: Record<string, unknown>

Defined in: createGatedToolRegistrar.ts:48

Tool metadata forwarded verbatim on tools/list — how a gated tool links to an MCP Apps view (registerAppResource(...).toolMeta()).


description​

description: string

Defined in: createGatedToolRegistrar.ts:32

Human-readable tool description.


gates?​

optional gates?: (ctx) => void | Promise<void>[]

Defined in: createGatedToolRegistrar.ts:43

Per-tool gates merged after the global gates. Useful for arg-conditional authorization (e.g. different subscription tiers based on call args). Each gate receives the full ToolCallContext (identity + args). Throw to reject the call; return (or resolve) to continue.

Parameters​

ParameterType
ctxToolCallContext

Returns​

void | Promise<void>


inputSchema​

inputSchema: unknown

Defined in: createGatedToolRegistrar.ts:36

Zod field map or ZodObject — passed through to server.registerTool.


method​

method: (args) => Promise<unknown>

Defined in: createGatedToolRegistrar.ts:50

The tool handler. Receives merged call args + buildContext output.

Parameters​

ParameterType
argsRecord<string, unknown>

Returns​

Promise<unknown>


name​

name: string

Defined in: createGatedToolRegistrar.ts:30

Tool name as registered with the MCP server.


requiredScope​

requiredScope: string

Defined in: createGatedToolRegistrar.ts:34

The single scope that must be present on the caller's token.