Skip to main content

@rtorcato/api-mcp v0.1.0

Functions

asText()

asText(value): object

Defined in: index.ts:11

Wrap any value as an MCP tool success result: a single text content block holding JSON.stringify(value). This is the MCP-native shape — deliberately not the { success, data } REST envelope from @rtorcato/api-response, since MCP tools have their own contract.

Return it directly from a registerTool handler.

Parameters

value

unknown

Returns

object


mcpError()

mcpError(text): object

Defined in: index.ts:20

Build an MCP tool error result: isError: true with the message in a text content block. Use for expected failures (not found, bad input) where you want the model to see the reason rather than throwing.

Parameters

text

string

Returns

object