tools/call so a remote MCP
server knows which task, workspace and end user a call is for, and can report
progress. Contract version 1. Every field is a standard MCP field or a header,
so any MCP client can still call the same server.
The TypeScript server side is @agentarea/tools. The platform side is
agentarea_mcp/tool_context.py (keys, token) and MCPServerInstanceService.execute_tool
(sending them).
Synopsis
When context is sent
AgentArea never sends
agentarea/* keys without a token, so a server never has
to trust _meta on its own.
Transport
_meta keys
progressToken is also set on every call (the MCP client uses the request id).
X-AgentArea-Context token
The key is the instance’s
context_secret as UTF-8 bytes.
Every
agentarea/* key in _meta has an equal claim, and the token has no
context claim that _meta lacks.
Verification a server performs
- Check the signature with an
HS256-only algorithm list,exp/iat(reject tokens older than 10 minutes, allow 30 s skew),audequal to the instance id, andissequal toagentarea. - If
toolis present, it must equalparams.name. - Every
agentarea/*key in_metamust equal its claim (objects compared independently of key order). - Run the tool only after all three pass.
id:
AgentArea reports a 401 or 403 to the agent as
MCP tool call failed: <host> rejected the credentials (HTTP 401).
Progress
The server sends standardnotifications/progress on the call’s response
stream. The worker relays them as tool.progress task events: stored in
task_events and put on the task’s live stream, so they appear in the task
SSE feed and its history.
Timeout
A call waits for its result for the instance’stool_timeout_seconds (in the
instance json_spec), progress notifications included, then fails as
MCP tool call timed out: no result within <n> s and the server is sent
notifications/cancelled.
Results
When
content is empty, the model reads structuredContent as text instead.
Tool names the model sees
An agent’s MCP tool is offered to the model asmcp__<server>__<tool>, at most
64 characters (a longer name is cut and ends in an 8-character digest).
<tool> is the raw tool name with characters outside [a-zA-Z0-9_-] replaced
by _. <server> comes from the instance name:
Two instances with the same
<server> on one agent are kept apart by a suffix
of the second one’s id. Your server receives the raw <tool> name in
tools/call, never the qualified one, so renaming affects only what the model,
the event stream and policy rules written against tool:mcp__… see.
Compatibility. Names of instances whose name is ASCII did not change. An
instance with a non-ASCII name was previously offered as mcp__ followed by one
_ per non-ASCII character; it now gets the readable label above. Running tasks
keep the names they started with. Rules written as tool:mcp:<instance id>:<tool>
(what approval toggles write) are unaffected; a hand-written rule that targeted
the old underscore name must be rewritten to the new name or, better, to
tool:mcp:<instance id>:<tool>. Client MCP endpoints apply the same label to a
non-ASCII instance name when the member has no namespace_prefix.
Idempotency
A retried tool activity sends the sametask_id, tool_call_id,
idempotency key and arguments, with a newly minted token. A server that is not
safe to re-run remembers the result per idempotency key and returns it for a
duplicate.
It can say so by setting _meta["agentarea/replayed"] to true on that result.
A retry’s tool.result carries attempt: <n>. It carries replayed: true when
the server said so, when a wallet payment for the call had already settled, or when
the call’s cost lines were already in the spend ledger; a replay never writes a
second line. Both fields are absent on a first, fresh call.
Setting the inputs
The model cannot set
metadata or end_user_id: they are task metadata,
written when the task is created and carried into every tool call of the task,
follow-ups included. Reading the task back (GET …/tasks/{task_id}, the task
lists) returns both to API key and service-client callers and null to anyone
else. To bill per end user, see
Charge your users for task cost.
Versioning
agentarea/protocol is "<major>" or "<major>.<minor>". Servers reject an
unknown major and accept any minor. Adding an optional key or claim is a minor
change; removing one or changing its meaning is a major change.
Security notes
- The static credential and
context_secretare different values. Leaking the credential lets an attacker call tools but not assert a workspace, task or end user. - Arguments are not covered by the signature. Within its 5-minute lifetime a token can be replayed at the same server for the same tool; idempotency makes a replay of the same call a no-op.
end_user_idandmetadataare assertions by the API caller that created the task, relayed by AgentArea. Authorize them against your own data.- HS256 means the server holding the secret could mint tokens for itself. Use one secret per instance.
- Rotation: the platform holds one secret per instance. Make the server accept
the old and the new secret,
PATCHthe instance with the new one, then drop the old one from the server.