delete-peer-agent
Remove a peer agent connection. Get its connection_id from
list-peer-agents or register-peer-agent.
A connection that an interop_agent node still delegates to is not removed. The call fails with an error that
names each such agent and its process flow, and nothing is removed, so a running process flow is not broken by
accident. Repoint each of those nodes at another connection, or remove the node, then delete the connection.
There is no rotate operation. To change a connection's credential, delete the connection and register it
again with register-peer-agent.
What it is called on each surface
The wire name is delete-peer-agent everywhere: it is what the Wexa MCP server advertises, the REST path is
POST /v1/delete-peer-agent, and each SDK exposes it under its own language's naming convention.
| Surface | Name |
|---|---|
| Wexa MCP server | delete-peer-agent |
| REST API | POST /v1/delete-peer-agent |
| TypeScript SDK | fabric.deletePeerAgent() |
| Python SDK | fabric.delete_peer_agent() |
Arguments
1 of the 1 argument is required. Omitting a required one is refused before the tool runs, at the validation stage, so it costs nothing and changes nothing.
| Argument | Type | Required | Notes |
|---|---|---|---|
connection_id | string | Required | From list-peer-agents or register-peer-agent. |
project_id, projectID, organization_id and executed_by are not arguments you pass: the
platform binds all four from the credential you authenticated with, and both SDKs refuse them
before the request leaves your process — see
server-bound arguments.
What it returns
| Field | What it is |
|---|---|
connection_id | The connection that was removed. |
deleted | true. A connection that was not removed is an error, never a result. |
still_referenced_by | Always empty on a result: a connection something still references is refused instead. |
The three surfaces wrap this differently, and code written against one will not read another correctly — see return shape.
An example of what delete-peer-agent returns. Every field shown is one the tool really sets: the
shape was checked against a live call to a running deployment. The ids, endpoints and
names are illustrative, so swap them for your own.
{
"content": [
{
"type": "text",
"text": "{\"lifecycle_id\":\"qlc_000065\",\"result\":{\"connection_id\":\"6ab3e1c07f2d9a4b1c5e8d20\",\"deleted\":true,\"still_referenced_by\":[]}}"
}
],
"isError": false
}Keeping the lifecycle_id is what lets you ask later why a call was allowed, refused or held.
Calling it
The same call on all four surfaces. Pick a tab once and every code block in the documentation follows it.
A value in angle brackets is one only you can supply, and the platform refuses a literal <...>.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "delete-peer-agent",
"arguments": {
"connection_id": "<connection_id>"
}
}
}Errors
Both SDKs raise the same typed errors, chosen from the gateway's own error string first and its
HTTP status second. delete-peer-agent checks the fabric:orchestrate.write grant, and reaches the seven classes every
tool reaches — listed under the common set. These are the ones specific to it:
| Error | Status | Raised when |
|---|---|---|
ValidationError | 422 | connection_id is missing. |
UpstreamError | 502 | An interop_agent node still delegates to the connection. The message names each agent and its process flow, and says nothing was removed. Retrying will not help until those nodes are repointed or removed. |
UpstreamError | 502 | The platform could not check which agents still reference the connection, so it was left in place. |
ApprovalRequired | 202 | A policy held this call for a person to approve. The error carries the approval id; see below. |
ConfigurationError | 5xx | delete-peer-agent is not available to you. Retrying will not help. |
A refusal for a connection still in use reads like this:
connection 6ab3e1c07f2d9a4b1c5e8d20 is still delegated to by "Match invoices" in process flow "Accounts payable" — repoint each one at another connection, or remove the node, then delete this connection. Nothing was removed.
Governance
Every call to delete-peer-agent runs through the same ten-stage lifecycle as every other tool: the
credential is resolved to a scope, the fabric:orchestrate.write grant is checked, quota is drawn down, the arguments are
validated, policy rules are evaluated, the call is executed, the result is shaped and redacted, and an audit
record is written. The lifecycle_id in the response is the handle to that record.
delete-peer-agent is marked consequential, which means it changes something rather than only reading. Two things
follow. It is audited in full rather than lightly, and a policy rule may hold it for human approval — in which
case the call returns 202 and an ApprovalRequired error carrying the approval id, and the SDKs can wait for
the decision and resume rather than making you call again.
See also
list-peer-agents,
register-peer-agent,
update-process-flow to change an agent already in a process flow,
the tool index, errors,
and which identifier goes where.