Liking cljdoc? Tell your friends :D

mcp-toolkit.json-rpc


call-remote-methodclj/s

(call-remote-method context {:keys [method params] :as message})

Calls a remote method via JSON-RPC. Returns a promise which either resolves with the message's result or rejects with the message's error.

Args: context - The session context containing session state and send-message function message - Map with :method and optional :params keys

Returns: A promise that resolves to the method result or rejects with the error.

Calls a remote method via JSON-RPC.
Returns a promise which either resolves with the message's result or
rejects with the message's error.

Args:
  context - The session context containing session state and send-message function
  message - Map with :method and optional :params keys

Returns:
  A promise that resolves to the method result or rejects with the error.
sourceraw docstring

close-connectionclj/s

(close-connection context)

Closes the connection if a close-connection function is available in the context.

Args: context - The session context that may contain a close-connection function

Returns: The result of calling close-connection, or nil if not available.

Closes the connection if a close-connection function is available in the context.

Args:
  context - The session context that may contain a close-connection function

Returns:
  The result of calling close-connection, or nil if not available.
sourceraw docstring

handle-messageclj/s

(handle-message context)

Handles incoming JSON-RPC messages, supporting both single messages and batch requests. Routes messages to appropriate handlers and manages responses.

Args: context - The session context containing message, session, and send-message

Returns: A promise that resolves when message handling is complete.

Handles incoming JSON-RPC messages, supporting both single messages and batch requests.
Routes messages to appropriate handlers and manages responses.

Args:
  context - The session context containing message, session, and send-message

Returns:
  A promise that resolves when message handling is complete.
sourceraw docstring

invalid-request-responseclj/s

source

invalid-tool-nameclj/s

(invalid-tool-name id tool-name)

Creates a JSON-RPC error response for when a tool name is invalid or unknown.

Args: id - The request ID from the original method call tool-name - The name of the tool that was invalid/unknown

Returns: A JSON-RPC error response map with invalid params error (-32602).

Creates a JSON-RPC error response for when a tool name is invalid or unknown.

Args:
  id        - The request ID from the original method call
  tool-name - The name of the tool that was invalid/unknown

Returns:
  A JSON-RPC error response map with invalid params error (-32602).
sourceraw docstring

method-not-found-responseclj/s

(method-not-found-response id)

Creates a JSON-RPC error response for when a requested method is not found.

Args: id - The request ID from the original method call

Returns: A JSON-RPC error response map with method not found error (-32601).

Creates a JSON-RPC error response for when a requested method is not found.

Args:
  id - The request ID from the original method call

Returns:
  A JSON-RPC error response map with method not found error (-32601).
sourceraw docstring

notificationclj/s

(notification topic)
(notification topic params)

Creates a JSON-RPC notification message.

Args: topic - The notification topic (string) params - (Optional) Parameters map to include with the notification

Returns: A JSON-RPC notification map with method set to 'notifications/<topic>'.

Creates a JSON-RPC notification message.

Args:
  topic  - The notification topic (string)
  params - (Optional) Parameters map to include with the notification

Returns:
  A JSON-RPC notification map with method set to 'notifications/<topic>'.
sourceraw docstring

parse-error-responseclj/s

source

resource-not-foundclj/s

(resource-not-found id uri)

Creates a JSON-RPC error response for when a requested resource is not found.

Args: id - The request ID from the original method call uri - The URI of the resource that was not found

Returns: A JSON-RPC error response map with resource not found error (-32002).

Creates a JSON-RPC error response for when a requested resource is not found.

Args:
  id  - The request ID from the original method call
  uri - The URI of the resource that was not found

Returns:
  A JSON-RPC error response map with resource not found error (-32002).
sourceraw docstring

send-messageclj/s

(send-message context message)

Sends a message using the context's send-message function.

Args: context - The session context containing the send-message function message - The message to send

Returns: The result of calling the send-message function.

Sends a message using the context's send-message function.

Args:
  context - The session context containing the send-message function
  message - The message to send

Returns:
  The result of calling the send-message function.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close