Liking cljdoc? Tell your friends :D

modex-bb.mcp.tools

Tool definition macros and utilities for Babashka MCP servers.

Tool definition macros and utilities for Babashka MCP servers.
raw docstring

argmapclj

(argmap m)

Takes a {:keys [...]} argument map and extracts :type, :doc & :required to metadata.

Takes a {:keys [...]} argument map and extracts :type, :doc & :required to metadata.
sourceraw docstring

deftoolscljmacro

(deftools name & tool-defs)

Calls tools and binds to a symbol via def.

Calls tools and binds to a symbol via def.
sourceraw docstring

extract-mcp-metaclj

(extract-mcp-meta m)

Extracts MCP tool metadata from a {:keys [...]} map.

Extracts MCP tool metadata from a {:keys [...]} map.
sourceraw docstring

handlercljmacro

(handler [map-arg] & body)

Like fn but returns a fn with :mcp metadata for MCP Tool construction.

Like fn but returns a fn with :mcp metadata for MCP Tool construction.
sourceraw docstring

invoke-handlerclj

(invoke-handler handler arg-map)

Invokes tool handler & arg-map. Returns result or throws on exception.

Invokes tool handler & arg-map.
Returns result or throws on exception.
sourceraw docstring

invoke-toolclj

(invoke-tool {:as tool :keys [handler args]} arg-map)
  1. Validates tool input parameters (missing args or wrong types)
  2. Calls invoke-tool-handler, gathers result
  3. Returns {:keys [success results errors]}
1. Validates tool input parameters (missing args or wrong types)
2. Calls invoke-tool-handler, gathers result
3. Returns {:keys [success results errors]}
sourceraw docstring

IToolcljprotocol

input-schemaclj

(input-schema this)

required-argsclj

(required-args this)
source

mcp-meta-keysclj

source

missing-elementsclj

(missing-elements required input)

Returns seq of elements in required that are not present in input.

Returns seq of elements in required that are not present in input.
sourceraw docstring

missing-tool-argsclj

(missing-tool-args tool-args arg-map)

Returns a seq of missing args or nil, for args with :required true.

Returns a seq of missing args or nil, for args with :required true.
sourceraw docstring

toolcljmacro

(tool [tool-name & tool-body])
source

tool->json-schemaclj

(tool->json-schema {:as tool :keys [name doc]})

Builds MCP-compatible {:keys [name description inputSchema]}.

Builds MCP-compatible {:keys [name description inputSchema]}.
sourceraw docstring

tool-arg->propertyclj

(tool-arg->property tool-arg)
source

tool-args->input-schemaclj

(tool-args->input-schema args)
source

tool-v1cljmacro

(tool-v1 [tool-name & tool-body])

Deprecated. Superseded by tool-v2-argmap, but still supported via tool.

Deprecated. Superseded by tool-v2-argmap, but still supported via tool.
sourceraw docstring

tool-v2-argmapcljmacro

(tool-v2-argmap [tool-name & tool-body])

Primary tool definition macro using map destructuring.

Primary tool definition macro using map destructuring.
sourceraw docstring

toolscljmacro

(tools & tool-defs)

Returns a map of tool name => Tool.

Returns a map of tool name => Tool.
sourceraw docstring

validate-arg-typesclj

(validate-arg-types args arg-map)

Validates argument types based on tool parameter definitions

Validates argument types based on tool parameter definitions
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close