Function: mcp-async-read-resource

mcp-async-read-resource is a natively compiled function defined in mcp.el.

Signature

(mcp-async-read-resource CONNECTION URI &optional CALLBACK ERROR-CALLBACK)

Documentation

Call a resource on the remote CONNECTION with URI.

CONNECTION is the MCP connection object. URI is the URI of the resource to call. CALLBACK is a function to call with the result on success. ERROR-CALLBACK is a function to call with the error code and message on failure.

This function asynchronously reads a resource from the remote connection using the specified URI. The result is passed to CALLBACK if the request succeeds, or ERROR-CALLBACK if it fails.

Source Code

;; Defined in /nix/store/5m747x13pb1ddrvbq9raj91c4q1h1kl0-emacs-packages-deps/share/emacs/site-lisp/elpa/mcp-20260615.940/mcp.el
(defun mcp-async-read-resource (connection uri &optional callback error-callback)
  "Call a resource on the remote CONNECTION with URI.

CONNECTION is the MCP connection object.
URI is the URI of the resource to call.
CALLBACK is a function to call with the result on success.
ERROR-CALLBACK is a function to call with the error code and message on failure.

This function asynchronously reads a resource from the remote connection
using the specified URI. The result is passed to CALLBACK if the request
succeeds, or ERROR-CALLBACK if it fails."
  (jsonrpc-async-request connection
                         :resources/read
                         (list :uri uri)
                         :timeout (mcp--timeout connection)
                         :success-fn
                         (lambda (res)
                           (funcall callback res))
                         :error-fn
                         (jsonrpc-lambda (&key code message _data)
                           (funcall error-callback code message))))