Skip to main content

Interface: OpenApiToToolsArgs

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:28

Properties​

callApi​

callApi: (request) => unknown

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:38

Performs the HTTP request for a resolved tool call and returns the raw response data. This package builds the method/url/body; the caller owns how the request is executed — base URL, auth headers, fetch impl, etc.

Parameters​

ParameterType
requestResolvedRequest

Returns​

unknown


options?​

optional options?: OpenApiToToolsOptions

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:32

Tuning options forwarded to openApiToToolDefinitions.


serverParameters?​

optional serverParameters?: (args) => Record<string, unknown> | Promise<Record<string, unknown>>

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:89

Supplies the values of the tool's server-managed path and query parameters (tool.serverManagedParameters), keyed by their spec name. Runs on every call, after any value the model sent for those parameters has been discarded.

Parameters​

ParameterType
args{ headers: Record<string, string>; tool: ToolDefinition; }
args.headersRecord<string, string>
args.toolToolDefinition

Returns​

Record<string, unknown> | Promise<Record<string, unknown>>

Example​

serverParameters: ({ headers }) => ({
project_id: projectIdFromToken(headers.Authorization),
}),

spec​

spec: OpenApiSpec | OpenApiSpec[]

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:30

One or more OpenAPI documents to derive tools from.


toolMeta?​

optional toolMeta?: (args) => Record<string, unknown> | undefined

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:73

Builds each tool's _meta, advertised on tools/list. This is how a generated tool links to an MCP Apps view: return the bag from registerAppResource(...).toolMeta(). undefined sets no _meta.

Parameters​

ParameterType
args{ tool: ToolDefinition; }
args.toolToolDefinition

Returns​

Record<string, unknown> | undefined

Example​

toolMeta: ({ tool }) =>
tool.name === 'get-agent' ? agentCard.toolMeta() : undefined,

toStructuredContent?​

optional toStructuredContent?: (args) => Record<string, unknown> | undefined

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:58

Builds the tool result's structuredContent from the raw API data, sent beside the text payload. Return undefined to keep a result text-only, which is every result when this is unset.

Parameters​

ParameterType
args{ data: unknown; tool: ToolDefinition; }
args.dataunknown
args.toolToolDefinition

Returns​

Record<string, unknown> | undefined

Example​

toStructuredContent: ({ data }) =>
typeof data === 'object' && data !== null && !Array.isArray(data)
? (data as Record<string, unknown>)
: undefined,

toText?​

optional toText?: (data) => string

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:44

Serialises the raw API data into the MCP tool's text payload. The default passes strings through, pretty-prints anything else as JSON, and answers NO_CONTENT_TEXT for an empty body (e.g. a 204).

Parameters​

ParameterType
dataunknown

Returns​

string


validateArguments?​

optional validateArguments?: boolean

Defined in: http-server-mcp-openapi/src/openApiToTools.ts:99

Sets every tool's validateArguments: enforce the generated inputSchema before callApi runs. Leave it off unless the spec describes every value the API accepts — see Tool.validateArguments.

Default​

false