Set the MCP servers attached to a thread
Sets the whole set of MCP servers attached to the thread, in any state of the thread, finished ones included (a thread is a conversation: the set applies to the next message sent to the agent). servers lists the ids, from listToolServers, that should be attached afterwards. What differs from what the thread has is logged as a tools_attached and a tools_detached event (attributed to the person); the same set writes nothing and is still a 200, so the call is idempotent. The agent is told the attached servers it may use (attached of the thread-tools/v1 message) and finds their tools on the thread's endpoint; an agent whose card does not list thread-tools/v1 gets nothing, which a client says before the person sends (the capabilities document).
Anyone who may act on the thread (thread.write) may attach, the servers the deployment offers for the thread's agent (their agents), and the servers the thread's owner added themselves (ADR 0046, ids that start with u-, listUserToolServers) that are ready. A person's server has no agents list. A server the thread has already is not checked again: a deployment that stopped listing it, or a server of the person's that needs a new key, leaves the thread its attachment, and a person can detach it. Attaching asks the credential broker for nothing. A thread that is not the caller's is a 404 indistinguishable from one that does not exist, whatever their roles. Attaching a server the thread does not have is for the agent that will use it, so it takes agent.invoke for the thread's agent, its audience included (ADR 0045): for a thread whose agent the caller may no longer use, which is read-only for them, it is a 403. Keeping the servers the thread has, or taking them off, is not attaching and is still theirs.
A server of the person's that is not ready is a 422 with a code a client acts on: tool_server_needs_auth when the person has something to do (the server has no key or authorization yet, its key or authorization ended, it was disconnected: the picker's needs_auth), and tool_server_unavailable when a cause outside them has to clear (they lack tools.user.add, today's egress lists refuse the server, the deployment keeps no credentials: the picker's unavailable). The detail names the id and says why in words. A server that is not the caller's own, one that does not exist, a malformed u- id and a deployment that has people's own servers off are all the same 422, with no code and the sentence of an unknown id, so the answer does not say whether somebody else has a server by that id.
Authorizations
A JWT signed by the configured issuer (RS256, RS384, ES256 or EdDSA), with the configured audience. Read when auth.mode is jwt or jwt_or_proxy_header. A missing or refused token gets 401 with WWW-Authenticate: Bearer; an issuer whose keys cannot be fetched gets 503.
A JWT as bearerToken, bound to the key of the client (cnf.jkt, RFC 7638), sent as Authorization: DPoP <token> with one DPoP header holding a proof signed by that key (RFC 9449, ADR 0054). Read only when auth.dpop is configured. A bad proof gets 401 with WWW-Authenticate: DPoP error="invalid_dpop_proof", algs="ES256 EdDSA", a bad or unbound token error="invalid_token".
Set by oauth2-proxy after OIDC login; requests without it get 401. Read when auth.mode is proxy_header (the default) or jwt_or_proxy_header without a bearer token.
Request Body
Responses
The set after the change