Skip to main content

Interface: ToolDefinition

Defined in: http-server-mcp-openapi/src/types.ts:41

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

The path / query / body builders turn the arguments an MCP client sends (named per OpenApiToToolsOptions.argumentNames) 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: http-server-mcp-openapi/src/types.ts:72

Spec 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: http-server-mcp-openapi/src/types.ts:67

Builds the request body keyed by the spec's property names, or undefined if the op has no body.

Parameters​

ParameterType
argsRecord<string, unknown>

Returns​

Record<string, unknown>


description​

description: string

Defined in: http-server-mcp-openapi/src/types.ts:45

Sanitised operation description (quotes escaped, newlines flattened).


extensions​

extensions: Record<string, unknown>

Defined in: http-server-mcp-openapi/src/types.ts:78

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: http-server-mcp-openapi/src/types.ts:47

Plain JSON Schema describing the tool's input object.


method​

method: string

Defined in: http-server-mcp-openapi/src/types.ts:49

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


name​

name: string

Defined in: http-server-mcp-openapi/src/types.ts:43

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


operationId​

operationId: string

Defined in: http-server-mcp-openapi/src/types.ts:53

The operation's operationId.


path​

path: (args) => string

Defined in: http-server-mcp-openapi/src/types.ts:60

Builds the request path, substituting path params from the args. Throws when an argument a path param needs is missing.

Parameters​

ParameterType
argsRecord<string, unknown>

Returns​

string


pathTemplate​

pathTemplate: string

Defined in: http-server-mcp-openapi/src/types.ts:51

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


query?​

optional query?: (args) => string

Defined in: http-server-mcp-openapi/src/types.ts:62

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

Parameters​

ParameterType
argsRecord<string, unknown>

Returns​

string


serverManagedParameters​

serverManagedParameters: ServerManagedParameter[]

Defined in: http-server-mcp-openapi/src/types.ts:85

Path and query parameters flagged with the server-managed extension. They are absent from inputSchema, but path / query still read them from the args under argName, so the consumer fills them before building the request — openApiToTools does it through serverParameters.


tags​

tags: string[]

Defined in: http-server-mcp-openapi/src/types.ts:55

The operation's tags, e.g. to filter the deferred search by module.