mcp-context-forge icon indicating copy to clipboard operation
mcp-context-forge copied to clipboard

[UI-REWRITE]: Add a Try it tab to the agent details drawer

Open a-effort opened this issue 1 month ago • 1 comments

Summary:

Add a way to test an agent after connecting it to confirm that the endpoint, credentials, and protocol version work in the new, React UI. POST /v1/a2a/{agent_id}/test performs this check. Design

Notes:

  • #6696 and #6699 resolved the earlier blockers.
  • No part of the product currently checks agent reachability. The reachable column defaults to True, and no v1 route or background task updates it.
  • Until #7348 merges, the gateway records a 200 response containing a JSON-RPC error as a successful invocation. A test the tab shows as failed counts as a success in metrics.

Proposed changes:

  • Add a Try it tab to the agent details drawer (#7023) that calls POST /v1/a2a/{agent_id}/test, following ToolDetailsPanel and ToolTryItTab.
  • Add one optional text field for query, up to 4096 characters. An empty field sends the service default, so the tab also works as a connectivity check.
  • Let the service choose the request body from agent_type. The tab builds no A2A messages and needs no JSON editor.
  • Show the tab only to users with a2a.invoke. viewer lacks it.
  • Before submit, tell the user that the call reaches the agent, records a metric, updates last_interaction, and can create a task.
  • Render the reply by protocol_version. v1 uses TASK_STATE_* and ROLE_*. Earlier versions use lowercase states and a kind on each part. ToolResultRenderer returns null for A2A results, so the tab needs its own renderer.
  • Show a 200 response with a JSON-RPC error in result as a failed test, with its code and message, and note that the HTTP request succeeded.
  • Treat result.error of null as an empty result. invoke_agent returns {"error": null} for an empty 200 body.
  • Show error_type and the message from a failure body. Add an extractor for detail.error_type. lib/errorUtils.ts and utils/errors.ts read neither and fall back to a generic message.
  • Show the task from the response body when present, without links to or polling of the task routes. Those routes require ownership while /test requires visibility, so a non-owner gets 404 for the task their own test created.
  • Use features.a2a from GET /v1/auth/email/me to show or hide the tab. The OpenAPI document cannot indicate this, because the router stays mounted when A2A is off.
  • Refresh openapi.json and regenerate the client. The current file predates #7362 and has no types for the test route, A2ATestRequest or A2ATestResponse. A2ATestResponse uses snake_case keys, unlike A2AAgentRead.

Acceptance criteria:

  • [ ] Submitting the field sends POST /v1/a2a/{agent_id}/test and shows the reply.
  • [ ] Submitting an empty field returns a result, not a validation error.
  • [ ] A user without a2a.invoke does not see the tab.
  • [ ] A 200 response with a JSON-RPC error in result shows as a failure with code and message.
  • [ ] A 200 response with an empty body shows no error.
  • [ ] A failure response shows error_type and the body message, not a generic message.
  • [ ] A response with a task shows the task id and state, without links to task routes.
  • [ ] A read timeout shows as a timeout, separate from an agent failure.
  • [ ] input-required and auth-required show as neither success nor failure.
  • [ ] The tab is hidden when features.a2a is false.
  • [ ] Tests confirm refusal for a user without a2a.invoke, an agent outside the caller's teams, and A2A disabled.

Not included: Anything beyond a single text message. Multi-part messages, file parts and methods other than send need /v1/a2a/{agent_name}/invoke or /jsonrpc and a JSON editor.

Related issues: #7023, #7026, #7348, #6277, #7392

a-effort avatar Oct 28 '26 04:10 a-effort

Done in contextforge-org/contextforge-web-ui#265 (merged 2026-11-27).

The agent details drawer now has a Try it tab. It calls POST /v1/a2a/{agent_id}/test and meets the acceptance criteria:

  • An empty field sends {} and returns a result.
  • The tab shows only with a2a.invoke and features.a2a true.
  • A 200 response with a JSON-RPC error in result shows as a failure with its code and message. A 200 response with {"error": null} shows no error.
  • A failure shows error_type and the body message.
  • A response with a task shows the task id and state, with no task links.
  • A timeout shows separately from an agent failure.
  • input-required and auth-required show as Waiting.
  • openapi.json and the generated client now include the test route, A2ATestRequest, and A2ATestResponse.

marekdano avatar Nov 27 '26 15:11 marekdano