toolnexus.mcp/resource-tools
Clojure (JVM) + cljgo · package net.clojars.muthuishere/toolnexus · SPEC §2 · clojure/src/toolnexus/mcp.cljc
(mcp/resource-tools source) ; source: a from-config result, or a seq of connections;; => [list_mcp_resources read_mcp_resource] both read-only (:hints {:read-only true …})
;; list_mcp_resources {:server "docs"} ; :server optional, default all;; read_mcp_resource {:server "docs" :uri "…"}MCP servers expose resources (files, records, documents) beside their tools. resource-tools
returns two tools bound to the connected servers of a source: list_mcp_resources (uri, name,
description, mimeType, optionally for one server) and read_mcp_resource. They are opt-in: add them
to the toolkit only when the model should browse resources. A source with no connected server still
returns both; they report that no server is connected. They stop working once the source is
disconnected.
When to use it
Section titled “When to use it”- Docs or knowledge servers that publish content as resources rather than tools.
- When the model should discover context itself instead of the host pre-loading it.
Why this and not the alternative
Section titled “Why this and not the alternative”Examples
Section titled “Examples”1. Two read-only tools, even with nothing connected
Section titled “1. Two read-only tools, even with nothing connected”(require '[toolnexus.mcp :as mcp] '[toolnexus.tool :as tool])
(println)
(def rts (mcp/resource-tools []))(assert (= ["list_mcp_resources" "read_mcp_resource"] (mapv :name rts)))(assert (every? #(true? (get-in % [:hints :read-only])) rts))
(def r (tool/execute (tool/toolkit rts) "list_mcp_resources" {}))(println (:output r))(println "OK")2. Added beside the server’s tools
Section titled “2. Added beside the server’s tools”(def src (mcp/from-config (slurp "mcp.json")))(def tk (tool/toolkit (concat (:tools src) (mcp/resource-tools src))))3. Reading one resource directly
Section titled “3. Reading one resource directly”(tool/execute tk "read_mcp_resource" {:server "docs" :uri "file:///guide.md"})See also
Section titled “See also”mcp/from-config— the source these tools bind to.