> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formation.texturehq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Application client tools

> Publish app-owned tool contracts and execute the enabled subset in the authenticated client that initiated a run.

Application client tools dispatch a typed operation to a live application session.
Formation owns the tool offer, input validation, policy, and run receipt. The
application owns the handler and rechecks the user's access and current screen.
Client tools use the normal tool loop alongside configured integrations.

## Publish and enable

An operator with access to the agent can publish a version 1 manifest using
`PUT /api/agents/{slug}/connectors/{connectorID}/client-tools`. The connector
must belong to that agent and use the generic application transport. The request
contains `version` and `tools`, and the response reports the content revision.
Each tool declares these fields.

| Field | Purpose |
| - | - |
| `id`, `version` | Stable dotted application ID and positive schema version. |
| `name` | Snake-case model alias, exposed with a `client_` prefix. |
| `label`, `description`, `group`, `availability` | Operator and model copy. |
| `surfaceTransition` | Optional. A view tool may settle with a new surface and its current capabilities. |
| `effect` | `view` for local view changes or `draft` for reviewable UI. |
| `defaultConfirmation` | `direct` or `required`. |
| `inputSchema`, `resultSchema` | Closed, inline JSON object schemas. |

Publication replaces the catalog atomically. New versions start disabled, and
republishing identical definitions retains existing grants. Published versions
are immutable. Publish both versions while old clients still need support.
When a tool leaves the catalog it becomes unavailable immediately. The agent's
**Client tools** section lists the current catalog and controls enablement and
confirmation. The product's required confirmation is a floor.

## Send and handle a call

On a new direct message, the application can include `client_tool_session`
in the signed command bytes. It contains the mounted session's UUID
`sessionId`, a `target` with `scopeId`, `surfaceId` and `revision`, and
`tools` as a list of supported `{id, version}` pairs. These are capabilities
for that turn. They never grant new permissions. Use a different unpredictable
session ID for each mount. Keep that ID stable during retries of the same
command. Keep client tool activations out of background, group, and steering
commands.

The trusted application backend exchanges a signed
`create_client_tool_session` operation for a short-lived bearer. The exchange
identifies the actor, conversation, and `client_tool_session_id`. The client
uses the bearer with the following endpoints.

* `POST /generic/client-sessions/tool-calls/poll` returns the current invocation
  or null after a short wait. Poll only while an interactive turn can reach the mounted surface.
* `POST /generic/client-sessions/tool-calls/approval` records the actor's
  affirmative interaction for the exact `id` when confirmation is required.
  Only execute after this endpoint acknowledges the decision.
* `POST /generic/client-sessions/tool-calls/receipt` settles that call.
  `succeeded` includes `result.data` and may include the resulting
  `nextTarget` for a subsequent call. `rejected` means the handler did not
  enter. `unknown` means the client could not confirm the outcome.

Treat the invocation ID as the local idempotency key. Repeating the same receipt
is safe. The calls never appear as executable events in conversation history.
On mount changes, expiry, actor changes or stale view revisions, reject the
call before invoking app code. Formation distinguishes an unclaimed request
from a claimed request whose outcome could not be confirmed. Neither is
automatically sent to another session.

### App context and navigation

When the conversation snapshot advertises `capabilities.applicationToolContext`,
an interactive client may attach `context` to its activation. Version 1
includes the focused screen ID, observation revision, a compact list of
client-resolvable destinations, and optional visible state. The encoded
context is limited to 8 KiB. Keep it detached from the app store and include
only explicitly selected, already-readable observations. Formation sends it
as untrusted input rather than system instructions. The tool definitions
actually sent to the model are recorded on the model call alongside the
client advertisement. When runtime traces are enabled, the
`application_tool_offer` span event reports each advertised version as
offered, unpublished, or missing a grant.

For a navigation tool published with `surfaceTransition: true`, a successful
receipt can return `result.nextSession` in place of `result.nextTarget`.
The client returns it after the destination is ready. It contains the same
session ID and scope, a new target, current supported tool versions, and
app context. Formation reconstructs the latest state from durable receipts
after a restart and re-evaluates the offer against active grants. A client
cannot grant a tool by advertising it. A navigation call and another app
action must be issued in separate model rounds. Common application
operations can navigate and update the destination within one typed tool.

The client still rejects calls after an unrelated screen, window, actor, or
workspace change. Background turns have no live application target.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.