Skip to content

feat: Add fetch-actor-mcp-tool-list #1644

Closed

Description

@jirispilka

Part of #1620. Split from #1624; name by Jan on 2026-10-07. After #1643 and #1624. Included in the first release with #1624 and HTTP support; implement as a separate PR.

Problem
The only way to list an Actor's MCP tools is fetch-actor-details with output.mcpTools: true. That makes a tool advertised as a static read-only lookup connect to a third-party MCP server, wake a billed Server Actor, and apply a token/payment gate the rest of the tool does not have. The listing also comes back as one markdown string, not as tool definitions an agent can pass to call-actor-mcp-tool. Two contracts under one tool, same as the actor:tool overload #1624 removes from call-actor.

Change

  • fetch-actor-mcp-tool-list(actor): performs tools/list on the Actor's MCP server under the caller's credentials. Gate: the mcp flag. No tool-list cache (decided 2026-10-21; deferred in feat: Server Actor tools for the server interface and MCP tools #1620). The call explicitly performs remote discovery and may wake the Server Actor.
  • fetch-actor-details neither connects for discovery nor includes a list. The mcpTools output flag is removed. Its description points to fetch-actor-mcp-tool-list only when that tool is served in the session.
  • Descriptions and server instructions that say "actor:tool" or mcpTools: true change accordingly.
  • Default tool in the actors category.

Annotations (decided 2026-10-21)
readOnlyHint: false (listing can start a billed standby run), openWorldHint: false (lists tools, calls none), destructiveHint: false.

Acceptance

  • Return structuredContent: { tools: [...] } with the remote tool definitions (including schemas, annotations, and metadata), plus a compact text rendering per tool (name, description, input schema) for clients that use content. Not the pretty-printed structured payload.
  • Follow nextCursor until exhausted; a failed page fails the listing rather than returning a partial list. No public cursor.
  • Reuse the MCP execution tool's resolution, gate, and connection lifecycle (shared helper from feat!: Split MCP calls out of call-actor #1624). Pass the same external tool-call timeout to tools/list as call-actor-mcp-tool passes to tools/call. Apply feat: Server Actor tools for the server interface and MCP tools #1620's authentication/payment contract. Non-MCP Actors and missing credentials never connect; cover unknown Actors, connection errors, and cancellation.
  • Two calls perform two discoveries under their respective callers' credentials. Cover multiple pages and a page failure. Close the client on success and failure.
  • Details makes zero MCP connections: prove it with a unit test that spies on the MCP client connect, not with a text assertion. Remove the old output flag from schemas, tests, and instructions. No test that asserts the removed flag is absent from a schema.
  • Integration cases in tests/test_kit/cases/actors.cases.ts list apify/example-mcp-server (not apify/server-actor-test, which is the input/HTTP fixture). Keep a non-MCP Actor rejection case.
  • No telemetry fields: tool_name identifies discovery, which the KR query excludes from execution counts (feat: Record which Actor interface served a tool call #1622, decided 2026-10-22). The MCP connection sends the request-origin header (feat!: Split MCP calls out of call-actor #1624).
  • Say the billing caveat once, in the tool description. Server instructions get at most one line ([spec] Fit server instructions and search-actors description in Claude Code's 2 KB limit #1589 budget).
  • Keep the :toolName split in telemetry Actor-name extraction so rejected legacy actor:tool requests are attributed to the Actor. This normalization does not permit legacy execution.

Implementation notes (from a spike on 2026-10-21, discarded)
The spike copied forty lines of call-actor-mcp-tool (token check, resolution, non-MCP rejection, outcome switch), re-declared #1622's telemetry fields and set them in both the dispatcher and the tool, added a fourth hardcoded name to the engine's standby-gate chain, and bolted actorId onto the MCP resolution type for one tool only. Do none of that: land after #1622 and #1624's shared helper, declare the standby gate on the tool, and report actorId the same way both MCP tools do.

Context

Activity

  1. added
    t-ai
    on Oct 19, 2026
  2. changed the title [-]feat: Add fetch-actor-mcp-tool-list with a per-build cache[/-] [+]feat: Add fetch-actor-mcp-tool-list[/+] on Oct 20, 2026
  3. jirispilka commented on Oct 24, 2026

    @jirispilka
    CollaboratorAuthor

    Decided 2026-10-24: fetch-actor-mcp-tool-list stops following nextCursor after 100 pages and fails the listing with an error that says so ("The Actor's MCP server returned more than 100 pages of tools, so the listing stopped."). The remote server is third-party code, and a cursor that never runs out would otherwise keep one listing going indefinitely. Implemented in #1686.


    Generated by Claude Code

  4. self-assigned this
    on Oct 26, 2026
  5. added
    low priority
    on Oct 27, 2026
  6. added a commit that references this issue on Oct 28, 2026
    691acaa
  7. jirispilka commented on Oct 28, 2026

    @jirispilka
    CollaboratorAuthor

    Shipped in #1686 (691acaa on master, 0.19.6-beta.3).


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

low priorityt-ai

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions