Liking cljdoc? Tell your friends :D

hive-addon.tool-contract

The root-tool contract: what a tool def must carry to be served at an MCP root tools/list.

A root tool needs a non-blank :name and :description and an :inputSchema of type "object" with at least one property. Anything less is a VIOLATION. A property without a :description is a WARNING.

Enforcement points, all reading RootToolDef: host registration assert-root-tool! / assert-root-tools! load / compile time def-root-tool an addon's CI hive-addon.tool-contract.test/deftest-root-tools, hive-addon.tool-contract.check/-main

The root-tool contract: what a tool def must carry to be served at an MCP
root `tools/list`.

A root tool needs a non-blank :name and :description and an :inputSchema of
type "object" with at least one property. Anything less is a VIOLATION.
A property without a :description is a WARNING.

Enforcement points, all reading `RootToolDef`:
  host registration   `assert-root-tool!` / `assert-root-tools!`
  load / compile time  `def-root-tool`
  an addon's CI        `hive-addon.tool-contract.test/deftest-root-tools`,
                       `hive-addon.tool-contract.check/-main`
raw docstring

assert-root-tool!clj/s

(assert-root-tool! tool)

Return tool when it conforms; throw ex-info {:type :hive-addon/root-tool-contract :violations {label [Finding]}} otherwise.

Return `tool` when it conforms; throw ex-info
{:type :hive-addon/root-tool-contract :violations {label [Finding]}} otherwise.
sourceraw docstring

assert-root-tools!clj/s

(assert-root-tools! tools)

Return tools when every tool conforms; otherwise throw ONE ex-info naming every offending tool (same ex-data shape as assert-root-tool!).

Return `tools` when every tool conforms; otherwise throw ONE ex-info naming
every offending tool (same ex-data shape as `assert-root-tool!`).
sourceraw docstring

conforms?clj/s

(conforms? tool)

True when tool has no contract violations.

True when `tool` has no contract violations.
sourceraw docstring

def-root-toolcljmacro

(def-root-tool sym tool-def)

Def sym to tool-def, checked against the root-tool contract. A map literal is checked at macroexpansion, so a violation the source text already decides fails compilation; the evaluated value is checked again when the def runs.

Def `sym` to `tool-def`, checked against the root-tool contract.
A map literal is checked at macroexpansion, so a violation the source
text already decides fails compilation; the evaluated value is checked
again when the def runs.
sourceraw docstring

expansion-viewclj/s

(expansion-view form)

The tool def as far as source text decides it: a map literal with each non-literal contract value replaced by a conforming stand-in. nil when form is not a map literal.

The tool def as far as source text decides it: a map literal with each
non-literal contract value replaced by a conforming stand-in. nil when
`form` is not a map literal.
sourceraw docstring

Findingclj/s

One contract finding: where it is and what is wrong.

One contract finding: where it is and what is wrong.
sourceraw docstring

format-findingsclj/s

(format-findings label->findings)

Render {label [Finding]} as one line per finding.

Render {label [Finding]} as one line per finding.
sourceraw docstring

literal-form?clj/s

(literal-form? form)

True when form contains no symbol and no list: its value is the form.

True when `form` contains no symbol and no list: its value is the form.
sourceraw docstring

NonBlankStringclj/s

A string with at least one non-whitespace character.

A string with at least one non-whitespace character.
sourceraw docstring

Propertiesclj/s

The :properties of a root tool's :inputSchema. Never empty.

The :properties of a root tool's :inputSchema. Never empty.
sourceraw docstring

Propertyclj/s

One property's JSON schema. Open: any JSON-schema keys are allowed.

One property's JSON schema. Open: any JSON-schema keys are allowed.
sourceraw docstring

PropertyNameclj/s

A JSON-schema property key, as a string or keyword.

A JSON-schema property key, as a string or keyword.
sourceraw docstring

reportclj/s

(report tools)

Check every tool in tools. => {:checked n :violations {label [Finding]} :warnings {label [Finding]}}

Check every tool in `tools`.
=> {:checked n :violations {label [Finding]} :warnings {label [Finding]}}
sourceraw docstring

RootInputSchemaclj/s

The :inputSchema a root tool must carry.

The :inputSchema a root tool must carry.
sourceraw docstring

RootToolDefclj/s

A tool def fit for an MCP root. Open: hosts and addons add keys.

A tool def fit for an MCP root. Open: hosts and addons add keys.
sourceraw docstring

tool-labelclj/s

(tool-label tool)

The tool's :name for messages, or a placeholder when it has none.

The tool's :name for messages, or a placeholder when it has none.
sourceraw docstring

violationsclj/s

(violations tool)

Contract violations of tool as a vector of Findings; [] when it conforms.

Contract violations of `tool` as a vector of Findings; [] when it conforms.
sourceraw docstring

warningsclj/s

(warnings tool)

Advisory findings of tool: each property lacking a non-blank :description.

Advisory findings of `tool`: each property lacking a non-blank :description.
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