On this page

handshake-peer-agent

Ask a candidate external agent who it is and what it says it can do, without creating anything. Use it to confirm that an endpoint answers before you commit a credential to it with register-peer-agent.

The secret you pass is used for this one call and is not stored. A handshake that fails reports why and leaves nothing behind.

What it is called on each surface

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

SurfaceName
Wexa MCP serverhandshake-peer-agent
REST APIPOST /v1/handshake-peer-agent
TypeScript SDKfabric.handshakePeerAgent()
Python SDKfabric.handshake_peer_agent()

Arguments

2 of the 5 arguments are required. Omitting a required one is refused before the tool runs, at the validation stage, so it costs nothing and changes nothing.

ArgumentTypeRequiredNotes
endpointstringRequiredThe external agent's full http:// or https:// URL.
protocolstringRequiredmcp or a2a — which protocol the external agent speaks.
secretstringOptionalThe bearer token or API key the external agent needs. Used for this call only; nothing is stored.
platformstringOptionalA label for which platform this agent runs on, recorded on the audit event.
authstringOptionalkey, oauth or mtls. Default key.

A protocol other than mcp or a2a is refused, and the refusal names both.

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

A handshake that went through returns ok: true, the endpoint and protocol you passed, and what the external agent said about itself:

FieldWhat it is
okWhether the external agent answered the handshake.
endpoint, protocolWhat you passed.
external_agent_name, declared_capabilityThe name and the description the external agent gave for itself.
declared_abilitiesThe abilities the external agent listed for itself. Absent when it listed none.
protocol_versionThe protocol version the external agent reported, when it reported one.
supports_cancelWhether the external agent says a delegated goal can be cancelled.

A handshake that fails is a result, not an error: it returns ok: false, the endpoint and protocol you passed, and a reason. Nothing was created, and the call can be repeated once the endpoint, the protocol or the credential is fixed. Read ok before you read anything else.

The three surfaces wrap this differently, and code written against one will not read another correctly — see return shape.

An example of what handshake-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_000062\",\"result\":{\"ok\":true,\"endpoint\":\"https://agents.example.com/a2a/invoice-reconciler\",\"protocol\":\"a2a\",\"external_agent_name\":\"Invoice Reconciler\",\"declared_capability\":\"Matches supplier invoices against purchase orders and flags mismatches.\",\"declared_abilities\":[\"match-invoice\",\"flag-mismatch\"],\"protocol_version\":\"0.2.5\",\"supports_cancel\":true}}"
    }
  ],
  "isError": false
}

The same call, against an endpoint that did not answer:

{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000063\",\"result\":{\"ok\":false,\"endpoint\":\"https://agents.example.com/a2a/invoice-reconciler\",\"protocol\":\"a2a\",\"reason\":\"the external agent could not be reached, or did not complete the a2a handshake. Check the endpoint, the protocol and the credential. Nothing was created.\"}}"
    }
  ],
  "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": "handshake-peer-agent",
    "arguments": {
      "endpoint": "https://agents.example.com/a2a/invoice-reconciler",
      "protocol": "a2a",
      "secret": "<the external agent's token>"
    }
  }
}

Errors

Both SDKs raise the same typed errors, chosen from the gateway's own error string first and its HTTP status second. handshake-peer-agent checks the fabric:orchestrate.read grant, and reaches the seven classes every tool reaches — listed under the common set. These are the ones specific to it:

ErrorStatusRaised when
ValidationError422endpoint is missing, or protocol is not mcp or a2a.
ConfigurationError5xxhandshake-peer-agent is not available to you. Retrying will not help.

An endpoint that cannot be reached, or that does not complete the handshake, is not an error: it comes back as the ok: false result shown above.

Governance

Every call to handshake-peer-agent 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.

handshake-peer-agent creates nothing, 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

register-peer-agent to commit the connection, list-peer-agents, the tool index, errors, and which identifier goes where.