> Source: https://wexa.ai/docs/tools/list-peer-agents

# list-peer-agents

List the peer agent connections this project holds. A peer agent connection is the registered link to an
external agent on another platform, one that a process flow can hand a whole goal to. Each entry carries its
`connection_id`, its name, platform, protocol, endpoint and state, and what the external agent said it can do.

The `connection_id` is what an `interop_agent` node, the external agent node, in a process flow points at: it
goes on the node as `registration_id`. Call this before you build one.

A stored credential is never returned, in any form, masked or otherwise. It is supplied once, to
[`register-peer-agent`](/docs/tools/register-peer-agent), and no tool gives it back.

## What it is called on each surface

The wire name is `list-peer-agents` everywhere: it is what the Wexa MCP server advertises, the REST path is
`POST /v1/list-peer-agents`, and each SDK exposes it under its own language's naming convention.

| Surface | Name |
| --- | --- |
| Wexa MCP server | `list-peer-agents` |
| REST API | `POST /v1/list-peer-agents` |
| TypeScript SDK | `fabric.listPeerAgents()` |
| Python SDK | `fabric.list_peer_agents()` |

## Arguments

`list-peer-agents` takes no arguments. Everything it needs — which organization and project you are asking
about, and who you are — comes from the credential you authenticated with, so there is nothing left for the
call itself to carry. Send an empty object.

`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](/docs/get-started/scope-and-server-bound-arguments).

## What it returns

`connections` holds one entry per connection, and `count` is how many there are. Each entry has these fields:

| Field | What it is |
| --- | --- |
| `connection_id` | The id an `interop_agent` node takes as `registration_id`, and the id `delete-peer-agent` takes. |
| `name`, `description` | The name given at registration, unique within the project, and its description. |
| `platform` | The label for which platform the external agent runs on, as given at registration. |
| `protocol`, `endpoint` | `mcp` or `a2a`, and the external agent's URL. |
| `state` | `Draft` when registered, `Active` once a call to the external agent has gone through. |
| `external_agent_name`, `declared_capability` | The name and the description the external agent gave for itself. |
| `declared_abilities` | The abilities the external agent listed for itself. Absent when it listed none. |

The last three are what the external agent said about itself when it answered the handshake, and they are
absent when it said nothing. `declared_abilities` are not skill ids: a skill is only ever what provisioning a
connector mints, and an `interop_agent` node carries no skills.

The three surfaces wrap this differently, and code written against one will not read another
correctly — see [return shape](/docs/tools/overview#return-shape).

An example of what `list-peer-agents` 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.

**Result of list-peer-agents**

**REST API**

```json
{
  "lifecycle_id": "qlc_000061",
  "result": {
    "connections": [
      {
        "connection_id": "6ab3e1c07f2d9a4b1c5e8d20",
        "name": "invoice-reconciler",
        "description": "Reconciles supplier invoices on the finance platform.",
        "platform": "finance-platform",
        "protocol": "a2a",
        "endpoint": "https://agents.example.com/a2a/invoice-reconciler",
        "state": "Active",
        "external_agent_name": "Invoice Reconciler",
        "declared_capability": "Matches supplier invoices against purchase orders and flags mismatches.",
        "declared_abilities": [
          "match-invoice",
          "flag-mismatch"
        ]
      }
    ],
    "count": 1
  }
}
```

**Wexa MCP server**

```json
{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000061\",\"result\":{\"connections\":[{\"connection_id\":\"6ab3e1c07f2d9a4b1c5e8d20\",\"name\":\"invoice-reconciler\",\"description\":\"Reconciles supplier invoices on the finance platform.\",\"platform\":\"finance-platform\",\"protocol\":\"a2a\",\"endpoint\":\"https://agents.example.com/a2a/invoice-reconciler\",\"state\":\"Active\",\"external_agent_name\":\"Invoice Reconciler\",\"declared_capability\":\"Matches supplier invoices against purchase orders and flags mismatches.\",\"declared_abilities\":[\"match-invoice\",\"flag-mismatch\"]}],\"count\":1}}"
    }
  ],
  "isError": false
}
```

**TypeScript SDK**

```ts
// the object you get back IS the result — there is no `.result` to read
{
  "connections": [
    {
      "connection_id": "6ab3e1c07f2d9a4b1c5e8d20",
      "name": "invoice-reconciler",
      "description": "Reconciles supplier invoices on the finance platform.",
      "platform": "finance-platform",
      "protocol": "a2a",
      "endpoint": "https://agents.example.com/a2a/invoice-reconciler",
      "state": "Active",
      "external_agent_name": "Invoice Reconciler",
      "declared_capability": "Matches supplier invoices against purchase orders and flags mismatches.",
      "declared_abilities": [
        "match-invoice",
        "flag-mismatch"
      ]
    }
  ],
  "count": 1
}

// The TS SDK names these camelCase — lifecycleId, traceId — where Python uses
// lifecycle_id and trace_id. Both are non-enumerable: readable, but omitted by
// Object.keys() and JSON.stringify(). `result.lifecycleId` here is undefined.
result.lifecycleId // 'qlc_000061'
```

**Python SDK**

```python
# a dict subclass; `result` is already unwrapped
{
 "connections": [
  {
   "connection_id": "6ab3e1c07f2d9a4b1c5e8d20",
   "name": "invoice-reconciler",
   "description": "Reconciles supplier invoices on the finance platform.",
   "platform": "finance-platform",
   "protocol": "a2a",
   "endpoint": "https://agents.example.com/a2a/invoice-reconciler",
   "state": "Active",
   "external_agent_name": "Invoice Reconciler",
   "declared_capability": "Matches supplier invoices against purchase orders and flags mismatches.",
   "declared_abilities": [
    "match-invoice",
    "flag-mismatch"
   ]
  }
 ],
 "count": 1
}

out.lifecycle_id  # 'qlc_000061' — an attribute, not a key
```

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 `<...>`.

**Call list-peer-agents**

**Wexa MCP server**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list-peer-agents",
    "arguments": {}
  }
}
```

**REST API**

```bash
curl -sS https://fabric.wexa.ai/v1/list-peer-agents \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

**TypeScript SDK**

```ts
import { Fabric } from '@wexa-fabric/sdk'

const fabric = new Fabric()
const result = await fabric.listPeerAgents()
```

**Python SDK**

```python
from wexa import Fabric

fabric = Fabric()
out = fabric.list_peer_agents()
```

## Errors

Both SDKs raise the same typed errors, chosen from the gateway's own error string first and its
HTTP status second. `list-peer-agents` checks the `fabric:orchestrate.read` grant, and reaches the seven classes every
tool reaches — listed under [the common set](/docs/tools/errors#the-common-set). These are the ones specific to it:

| Error | Status | Raised when |
| --- | --- | --- |
| `ConfigurationError` | 5xx | `list-peer-agents` is not available to you. Retrying will not help. |

## Governance

Every call to `list-peer-agents` runs through the same ten-stage lifecycle as every other tool: the
credential is resolved to a scope, the `fabric:orchestrate.read` 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.

`list-peer-agents` only reads, so it is not marked consequential: it is audited lightly and is never held for
approval. It still consumes quota and is still refused by policy like anything else.

## See also

[`handshake-peer-agent`](/docs/tools/handshake-peer-agent) to test an endpoint,
[`register-peer-agent`](/docs/tools/register-peer-agent),
[`delete-peer-agent`](/docs/tools/delete-peer-agent),
[`create-process-flow`](/docs/tools/create-process-flow) for the external agent node,
[the tool index](/docs/tools/overview), [errors](/docs/tools/errors),
and [which identifier goes where](/docs/tools/identifiers).
