Skip to main content

Interface: ToolDefinition

Defined in: types.ts:29

A REST-backed MCP tool derived from a single OpenAPI operation.

The path / query / body builders turn the camelCase arguments an MCP client sends into the pieces of an HTTP request against the original REST API. They intentionally hold no transport concerns (base URL, auth); the caller wires those in when it performs the request.

Properties

acceptedBodyFields

acceptedBodyFields: string[]

Defined in: types.ts:52

snake_case names of every top-level request-body property the operation's schema declares, including server-managed ones hidden from inputSchema.


body?

optional body?: (args) => Record<string, unknown>

Defined in: types.ts:47

Builds the snake_case request body, or undefined if the op has no body.

Parameters

ParameterType
argsRecord<string, unknown>

Returns

Record<string, unknown>


description

description: string

Defined in: types.ts:33

Sanitised operation description (quotes escaped, newlines flattened).


extensions

extensions: Record<string, unknown>

Defined in: types.ts:58

Every x- prefixed extension declared on the operation, forwarded verbatim. Lets consumers read custom metadata (e.g. x-iam-action) without this package needing to know about it.


inputSchema

inputSchema: JsonObjectSchema

Defined in: types.ts:35

Plain JSON Schema describing the tool's camelCase input object.


method

method: string

Defined in: types.ts:37

Uppercase HTTP method (GET, POST, PUT, PATCH, DELETE).


name

name: string

Defined in: types.ts:31

kebab-case tool name derived from the operation's operationId.


operationId

operationId: string

Defined in: types.ts:41

The operation's operationId.


path

path: (args) => string

Defined in: types.ts:43

Builds the request path, substituting path params from the args.

Parameters

ParameterType
argsRecord<string, unknown>

Returns

string


pathTemplate

pathTemplate: string

Defined in: types.ts:39

The raw OpenAPI path template, e.g. /agents/{agent_id}.


query?

optional query?: (args) => string

Defined in: types.ts:45

Builds the query string (including leading ?), or undefined if none.

Parameters

ParameterType
argsRecord<string, unknown>

Returns

string