toFetchHandler
function toFetchHandler(server: ToolkitDefinition): FetchHandler;Wrap a server definition as a runtime fetch handler.
GET *→{ tools }(thetools/listcorpus)POST *→ run the body as a tool call, returns ToolCallResult
Malformed JSON or a non-tool body yields a normalized BAD_REQUEST error
(HTTP 200 with { ok: false }), so the caller always parses a result rather
than a transport error.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
server | ToolkitDefinition | The compiled server definition. |
Returns
Section titled “Returns”A fetch handler the bundle can export as default.