Skip to content

Tools

One tool per operation

Every operation of the Clarive API, except logging in (auth.login), is a tool, named after the operation with the dot turned into an underscore:

Operation Tool What it does
topic.search topic_search Search the topics the caller can see
topic.explain_status_change topic_explain_status_change Tell whether the caller may move a topic to a status, and why not
job.logs job_logs Read a job log incrementally
job.get_root_cause job_get_root_cause Why a job failed
hcl.get_rule hcl_get_rule A rule as HCL text, ready to edit and save back
ci.get_many ci_get_many Several resources of any classes by mid, in one call
system.read_log system_read_log Read a Clarive server log (administrators)

Each tool carries:

  • a description: what it does, how its results look, and which other tools go with it;
  • an input schema (JSON Schema) for its parameters, with types, defaults, allowed values and descriptions;
  • annotations: readOnlyHint for tools that change nothing, destructiveHint for tools that delete or overwrite, and a title. Clients use them to decide what to ask you before running. Tools that change data also say so at the end of their description.

The namespaces are the same as the CLI's; see the table in Commands.

Which tools an agent sees

The list depends on who is asking:

  • tools whose permission the token's user lacks are left out (tools whose permission depends on the data, such as a topic's category, stay listed and are checked when called);
  • a read token, or the read_only option, leaves only the tools that change nothing;
  • the namespaces option leaves only those namespaces;
  • the compact mode replaces the list with four tools (below).

So two users connected to the same server can see different tool lists, and an agent never wastes a call on a tool it cannot use.

Finding the right tool

Three tools help an agent (or you) find its way. They are in every list, except when the namespaces option leaves out api:

Tool What it does
api_namespaces The namespaces, with what each covers and how many operations it has
api_search Operations matching a few words, by name, summary and description
api_describe One operation in full: description, parameters and their schema, kind and permission

When the server connects, it also tells the agent how Clarive is organized: what topics, jobs, rules and resources are; that tools are named <namespace>_<op>; that list tools take limit and skip and answer {items, total}; that topics, jobs and resources are identified by their mid; and that long operations return at once and are followed by polling.

Compact mode

With compact (clarive mcp --compact or /mcp?mode=compact) the agent gets only api_namespaces, api_search, api_describe and one more tool:

Tool Parameters
clarive_call op: the operation's name, e.g. job.list; params: its parameters as an object

The agent searches, reads the operation's parameters, and calls it through clarive_call. It costs one or two more steps per task, and saves the context the full list of tools would take. Use it with clients or models that cope badly with hundreds of tools. Permissions, read tokens and the read_only option apply to clarive_call exactly as to the full list.

Answers

A successful call answers with:

  • the data as text: pretty printed JSON, which every client can show and every model can read;
  • the same data as structured content (structuredContent), for clients that use it, when the data is an object.

Lists come one page at a time, as {"items": [...], "total": N, "skip": 0, "limit": 50}. The agent asks for more with skip, or for a smaller page with limit.

Answers longer than 256 KB of text are cut, with a note telling the agent to ask for less (limit, skip or narrower filters), so one answer cannot flood its context.

Operations that return a file (downloads, exports, the runner log of a job) answer:

  • text files up to 1 MB as text;
  • other files up to 10 MB as an embedded resource (base64), with their MIME type;
  • anything larger with an error that tells the agent to download it with the REST API or the CLI.

Errors

When an operation fails, the agent gets a tool result marked as an error (isError), with the error code and message, and the details when there are any:

forbidden: User jdoe may not move topic 4321 from 'New' to 'Done': From New to Done the workflow allows the roles Developer; in the projects of topic 4321 jdoe holds Tester

The codes are the API's (invalid_params, forbidden, not_found, conflict, failed...). Agents read them and correct themselves: an invalid_params error lists every wrong parameter, and a not_found for a mistyped operation in clarive_call suggests the closest names.

A malformed request (an unknown tool, arguments that are not an object) is a protocol error instead; see the protocol reference.

Long operations

Nothing makes an agent wait for minutes on one call. Creating a job returns at once with the job; the agent follows it with job_get and reads its log with job_logs, passing back the since_id cursor of the previous answer to get only new entries. Operations that run something on a remote server (server_execute, ci_run_service, rule_run) do wait for the command to end, within their own timeout.

Good to know

  • Identifiers: topics, jobs and resources go by their mid. Jobs also go by name (JOB-00012), statuses, categories, projects and labels by name or id.
  • Rules are easiest for an agent as HCL text: hcl_get_rule, edit, hcl_check, then hcl_save_rule passing the version_id it read as base_version, so it gets a conflict instead of overwriting someone else's newer version.
  • Secrets never come back in clear: passwords, keys and tokens are masked, and sending the masked value back keeps the stored one.
  • Every call fires event.mcp.call.