MCPconceptAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MCPRequestHandler.respond(to:emit:)

respond(to: String, emit: @escaping (String) async -> Void) -> String?

Answers one newline-delimited JSON-RPC request.

Description#

Returns the response line, or nil for a valid notification or an oversized request. Malformed JSON, invalid request objects, and request ids that cannot fit in a bounded response receive the standard JSON-RPC error with a null id.

  • Parameters:
    • line: one JSON-RPC request without its trailing newline.
    • emit: where a notification sent before the answer goes — progress, while a long call is still running. Writing them is the caller's job because they share the one stdout the answer uses, and two writers there would interleave.
Parameters
Esc

Type to search.

Reference previewOpen reference