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
| Parameter | Type |
|---|---|
request | ResolvedRequest |
Returns
unknown
options?
optionaloptions?:OpenApiToToolsOptions
Defined in: http-server-mcp-openapi/src/openApiToTools.ts:32
Tuning options forwarded to openApiToToolDefinitions.
serverParameters?
optionalserverParameters?: (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
| Parameter | Type |
|---|---|
args | { headers: Record<string, string>; tool: ToolDefinition; } |
args.headers | Record<string, string> |
args.tool | ToolDefinition |
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?
optionaltoolMeta?: (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
| Parameter | Type |
|---|---|
args | { tool: ToolDefinition; } |
args.tool | ToolDefinition |
Returns
Record<string, unknown> | undefined
Example
toolMeta: ({ tool }) =>
tool.name === 'get-agent' ? agentCard.toolMeta() : undefined,
toStructuredContent?
optionaltoStructuredContent?: (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
| Parameter | Type |
|---|---|
args | { data: unknown; tool: ToolDefinition; } |
args.data | unknown |
args.tool | ToolDefinition |
Returns
Record<string, unknown> | undefined
Example
toStructuredContent: ({ data }) =>
typeof data === 'object' && data !== null && !Array.isArray(data)
? (data as Record<string, unknown>)
: undefined,
toText?
optionaltoText?: (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
| Parameter | Type |
|---|---|
data | unknown |
Returns
string
validateArguments?
optionalvalidateArguments?: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