Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7c7522d
feat!: Add fetch-actor-mcp-tool-list
claude Oct 24, 2026
ac51556
chore: Merge the cloned-entry fix from #1624
claude Oct 24, 2026
35b872b
test: Count fetch-actor-mcp-tool-list and cover its x402 rejection
claude Oct 24, 2026
a591171
chore: Merge the review fixes from #1624
claude Oct 24, 2026
7d8914b
fix: Apply review fixes to fetch-actor-mcp-tool-list
claude Oct 24, 2026
76e873d
chore: Merge the request-origin and preflight telemetry fixes from #1624
claude Oct 24, 2026
a7ba38e
docs: Clarify MCP discovery and legacy output defaults
jirispilka Oct 24, 2026
4f6c638
chore: Merge MCP call contract wording
jirispilka Oct 24, 2026
39065e7
test: Cover shared MCP outcomes once per decision
jirispilka Oct 24, 2026
e4a8c46
chore: Merge the updated #1685 base
claude Oct 26, 2026
f282cbd
fix: List MCP tools without compiling their output schemas
claude Oct 26, 2026
7ac2544
chore: Merge the review fixes from #1685
claude Oct 26, 2026
bf090fa
fix: Apply staff review and simplifier findings on fetch-actor-mcp-to…
claude Oct 26, 2026
497dbb4
chore: Merge the matrix test cut from #1685
claude Oct 26, 2026
f64ef18
fix: Keep logging a legacy actor:tool call by its Actor name
claude Oct 26, 2026
6961820
fix: Give the whole MCP tool listing one external tool-call timeout
claude Oct 26, 2026
c818cf3
fix: Enforce the MCP tool listing deadline
jirispilka Oct 26, 2026
edb01f6
chore: Merge the updated #1685
claude Oct 26, 2026
90ebb36
docs: Say Server Actor run in fetch-actor-mcp-tool-list too
claude Oct 26, 2026
ebae079
chore: Merge the actor:tool recovery from #1685
claude Oct 26, 2026
897c523
chore: Merge the review fixes from #1685
claude Oct 26, 2026
5ffeb33
fix: Apply staff review and simplifier findings on the listing deadline
claude Oct 26, 2026
e146c22
chore: Merge the updated #1685 base
claude Oct 26, 2026
b0499b9
chore: Merge the test type fix from #1685
claude Oct 26, 2026
57e8950
chore: Merge the updated #1685 base
claude Oct 27, 2026
6786db7
chore: Merge master via the updated #1685
claude Oct 27, 2026
97b7c82
chore: Merge early legacy MCP syntax rejection
jirispilka Oct 27, 2026
c3063e6
chore: Merge MCP connection options rename
jirispilka Oct 27, 2026
4a332e3
chore: Merge MCP connection options documentation
jirispilka Oct 27, 2026
b722258
test: Enhance MCP tool call tests and remove redundant assertions
jirispilka Oct 27, 2026
6386760
chore: Merge the review fixes from #1685
claude Oct 28, 2026
affa937
chore: Merge the 5xx availability fix from #1685
jirispilka Oct 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Integration tests run against three purpose-built Actors defined in [apify/mcp-s
| Actor | Constant | Purpose |
|---|---|---|
| `apify/normal-mode-test-actor` | `ACTOR_NORMAL_MODE` | A normal Actor that writes dataset and key-value-store output. Exercises `call-actor`, the canonical run response, and the storage tools (`get-dataset-items`, `get-dataset`, `get-key-value-store-*`). |
| `apify/example-mcp-server` | `ACTOR_EXAMPLE_MCP_SERVER` | A standby MCP-server Actor. Exercises `call-actor-mcp-tool` and the MCP-in-MCP proxy path, where the server registers the Actor's own MCP tools as sub-tools. |
| `apify/example-mcp-server` | `ACTOR_EXAMPLE_MCP_SERVER` | A standby MCP-server Actor. Exercises `call-actor-mcp-tool`, `fetch-actor-mcp-tool-list` and the MCP-in-MCP proxy path, where the server registers the Actor's own MCP tools as sub-tools. |
| `apify/server-actor-test` | `ACTOR_SERVER_ACTOR_TEST` | A single-tenant Server Actor with an API schema (`webServerSchema`) and an input schema, no MCP path. Its HTTP API adds two numbers (`GET`/`POST /add`, the same item as a normal run) and has test endpoints that echo requests and return fixed statuses, content types, sizes, delays and a redirect. Exercises `send-server-actor-request` and the server-interface section of `fetch-actor-details`. |

### Test structure
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ Legend for the **Enabled by default** column:
| `fetch-actor-details` | actors | Retrieve detailed information about a specific Actor, including its input schema, README (summary when available, full otherwise), pricing, Actor output schema, and a Server Actor's HTTP operations. | ✅ |
| `call-actor` | actors | Call an Actor and get its run results. Use fetch-actor-details first to get the Actor's input schema. | ✅ |
| `send-server-actor-request` | none (select by name: `tools=send-server-actor-request`) | Send one HTTP request to a Server Actor's API, the server interface its API schema documents, and return the response. | |
| `fetch-actor-mcp-tool-list` | actors | List an Actor's MCP tools with their schemas, annotations, and metadata. | ✅ |
| `call-actor-mcp-tool` | actors | Call one tool on an Actor's MCP server and return its result. | ✅ |
| `get-actor-run` | runs | Get detailed information about a specific Actor run. | ⚡ |
| `get-dataset-items` | storage | Retrieve items from a dataset with support for filtering and pagination. | ⚡ |
Expand Down Expand Up @@ -432,6 +433,7 @@ The v2 configuration preserves backward compatibility with v1 usage. Notes:
- `tools=get-actor-log` is retired: the tool was renamed to `get-actor-run-log`. The old selector is ignored and loads no tools. Use `tools=get-actor-run-log` (or the `runs` category) instead.
- `tools=source` is retired: the category was renamed to `versions`. The old selector is ignored and loads no tools. Use `tools=versions` instead.
- `call-actor` no longer calls an MCP server Actor's tools: the `"actorName:toolName"` form of `actor` is rejected, and the result with `runId: 'mcp-passthrough'` is gone. Call `call-actor-mcp-tool` with `actor`, `tool`, and `arguments`; it returns the remote tool's result. It is in the `actors` category, so a selection naming `call-actor` alone needs `call-actor-mcp-tool` added.
- `fetch-actor-details` no longer lists an MCP server Actor's tools: `output.mcpTools` and the `mcpTools` field of `structuredContent` are removed, and details never connects to the Actor. Call `fetch-actor-mcp-tool-list` with `actor`; it returns the tool definitions in `structuredContent.tools`. It is in the `actors` category, so a selection naming `fetch-actor-details` alone needs `fetch-actor-mcp-tool-list` added. An `output.mcpTools` sent by an older client is ignored. If it was the only output option, details returns its default sections.

Existing URLs and commands using `?actors=...` or `--actors` continue to work unchanged.

Expand Down
1 change: 1 addition & 0 deletions src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const HELPER_TOOLS = {
ACTOR_CREATE: 'create-actor',
ACTOR_CALL_WIDGET: 'call-actor-widget',
ACTOR_MCP_TOOL_CALL: 'call-actor-mcp-tool',
ACTOR_MCP_TOOL_LIST: 'fetch-actor-mcp-tool-list',
ACTOR_SERVER_REQUEST: 'send-server-actor-request',
ACTOR_DELETE: 'delete-actor',
ACTOR_GET_DETAILS: 'fetch-actor-details',
Expand Down
2 changes: 1 addition & 1 deletion src/mcp/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Two MCP protocol revisions are served, each by its own adapter:
- `client.ts` — `connectMCPClient(url, options)`: transport negotiation; both transports send the token and the
session's request origin (`ApifyClient.requestOrigin`, `APIFY_AI` for the Apify AI client) on every request.
- `remote_tool_call.ts` — `withRemoteMcpClient()`: connect-call-close round trip for
`tool_dispatch.ts` and `call_actor_mcp_tool.ts`'s remote tool calls.
`tool_dispatch.ts` and the MCP server Actor tools (`runOnActorMcpServer` in `call_actor_mcp_tool.ts`).
- `proxy.ts` — MCP-in-MCP: `getMCPServerID(url)`, `getProxyMCPServerToolName(actorFullName, toolName)`.
- `actors.ts` — `getActorMCPServerPath()`: parses an Actor's `webServerMcpPath`; `resolveOnStandbyOrigin()`:
resolves a path against the Actor's `standbyUrl` (no `standbyUrl`, no URL) and flags a path that leaves that
Expand Down
4 changes: 3 additions & 1 deletion src/mcp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ export class ActorsMcpServer implements LegacyMcpServerHost, StatelessMcpServerH
if (this.options.paymentProvider) {
tools = tools.filter(
(tool) =>
tool.name !== HELPER_TOOLS.ACTOR_SERVER_REQUEST && tool.name !== HELPER_TOOLS.ACTOR_MCP_TOOL_CALL,
tool.name !== HELPER_TOOLS.ACTOR_SERVER_REQUEST &&
tool.name !== HELPER_TOOLS.ACTOR_MCP_TOOL_CALL &&
tool.name !== HELPER_TOOLS.ACTOR_MCP_TOOL_LIST,
);
}
if (this.isReportProblemServable(view, source.input)) return tools;
Expand Down
4 changes: 4 additions & 0 deletions src/tools/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ direct actor tools, `search-actors`, `fetch-actor-details`) is mode-agnostic.
`mcp` interface, with the remote `CallToolResult` passed through except for internal telemetry;
`runOnActorMcpServer` resolves the Actor and its MCP URL, connects under the caller's token and turns a failed
connection, an abort or a remote error into a response),
`fetch_actor_mcp_tool_list.ts` (`fetch-actor-mcp-tool-list`: an uncached `tools/list` through
`runOnActorMcpServer` that follows `nextCursor` within one `EXTERNAL_TOOL_CALL_TIMEOUT_MSEC` for all pages,
fails on a failed page and stops after `MAX_TOOL_LIST_PAGES`;
`fetch-actor-details` never connects to an MCP server),
`actor_tool_contract.ts` (Actor-specific presentation policies plus direct-tool input restrictions
and defaults, shared by schema generation, the call engine's denied-input check and execution;
generic calls skip direct-only restrictions and defaults), and
Expand Down
6 changes: 3 additions & 3 deletions src/tools/actors/call_actor_mcp_tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ const callActorMcpToolArgs = z.object({
});

function buildDescription({ hasTool }: ToolDescriptionContext): string {
const details = hasTool(HELPER_TOOLS.ACTOR_GET_DETAILS)
? `\n${HELPER_TOOLS.ACTOR_GET_DETAILS} with output.mcpTools lists the Actor's MCP tools and their input schemas.`
const toolList = hasTool(HELPER_TOOLS.ACTOR_MCP_TOOL_LIST)
? `\n${HELPER_TOOLS.ACTOR_MCP_TOOL_LIST} lists the Actor's MCP tools and their input schemas.`
: '';
return dedent`
Call one tool on an Actor's MCP server and return its result.${details}
Call one tool on an Actor's MCP server and return its result.${toolList}
It connects with your Apify API token. Connecting can start a Server Actor run in your account, kept until its idle timeout; a multi-tenant Server Actor charges per event. What the tool itself does depends on the Actor.

Example call: {"actor": "username/name", "tool": "search", "arguments": {"query": "apify"}}
Expand Down
40 changes: 12 additions & 28 deletions src/tools/actors/fetch_actor_details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
type ActorDetailsResult,
buildCardOptions,
fetchActorDetails as fetchActorDetailsFromApi,
getMcpToolsMessage,
resolveReadmeContent,
typeObjectToString,
} from '../../utils/actor_details.js';
Expand All @@ -33,7 +32,7 @@ import { buildServerInterfaceText } from './server_interface_schema.js';
* Shared schema for actor details output options.
*
* Behavior:
* - If output is undefined or empty object: use defaults (all true except mcpTools and outputSchema)
* - If output is undefined or empty object: use defaults (all true except outputSchema and serverInterface)
* - If any property is explicitly set: only include sections with explicit true values
*/
export const actorDetailsOutputOptionsSchema = z.object({
Expand All @@ -54,7 +53,6 @@ export const actorDetailsOutputOptionsSchema = z.object({
.boolean()
.optional()
.describe('Include inferred output schema from recent successful runs (TypeScript type).'),
mcpTools: z.boolean().optional().describe('List available tools (only for MCP server Actors).'),
serverInterface: z.union([z.boolean(), z.string()]).optional().describe(dedent`
Server Actor HTTP API. true: full schema with guidance when it fits; otherwise operation navigation.
"METHOD /path" (e.g. "GET /search"): operation excerpt. "#/...": raw node at a local JSON pointer.
Expand All @@ -71,7 +69,6 @@ export const actorDetailsOutputDefaults = {
inputSchema: true,
readme: true,
outputSchema: false,
mcpTools: false,
serverInterface: false as boolean | string,
};

Expand All @@ -97,7 +94,6 @@ export function resolveOutputOptions(output?: z.infer<typeof actorDetailsOutputO
inputSchema: output?.inputSchema === true,
readme: output?.readme === true,
outputSchema: output?.outputSchema === true,
mcpTools: output?.mcpTools === true,
serverInterface: output?.serverInterface ?? false,
};
}
Expand All @@ -118,6 +114,9 @@ export const fetchActorDetailsToolArgsSchema = z.object({
});

function buildDescription({ hasTool }: ToolDescriptionContext): string {
const mcpToolList = hasTool(HELPER_TOOLS.ACTOR_MCP_TOOL_LIST)
? `\nIt does not connect to an MCP server Actor; ${HELPER_TOOLS.ACTOR_MCP_TOOL_LIST} lists its MCP tools.`
: '';
return dedent`Get detailed information about an Actor by its ID or full name (format: "username/name", e.g., "apify/rag-web-browser").

Requires the exact ID or full name — do not construct a plausible-looking name and call this tool with it.${
Expand All @@ -128,21 +127,20 @@ find it with ${HELPER_TOOLS.STORE_SEARCH} first.`
}

Use 'output' to control returned information:
- Default: all fields except outputSchema, mcpTools and serverInterface.${
- Default: all fields except outputSchema and serverInterface.${
hasTool(HELPER_TOOLS.ACTOR_SERVER_REQUEST)
? ' Server Actors always get a one-line server interface summary unless serverInterface is true or a selector.'
: ''
}
- Selective: set only the fields you need to true, e.g. output: { inputSchema: true }
- Common patterns: inputSchema only, description + readme, mcpTools for MCP Actors, serverInterface: true (full API schema when it fits, operation navigation otherwise), "GET /search" (operation excerpt), or "#/components/schemas/Name" (referenced schema node) for Server Actors
- Common patterns: inputSchema only, description + readme, serverInterface: true (full API schema when it fits, operation navigation otherwise), "GET /search" (operation excerpt), or "#/components/schemas/Name" (referenced schema node) for Server Actors

The 'readme' field returns the summary when available, full README otherwise.
Use when querying Actor details, documentation, input requirements, or MCP tools.
Use when querying Actor details, documentation, or input requirements.${mcpToolList}

EXAMPLES:
- What does apify/web-fetch do?
- What is the input schema for apify/web-scraper?
- What tools does this MCP server Actor provide?
- What HTTP operations does this Server Actor expose?`;
}

Expand Down Expand Up @@ -177,22 +175,18 @@ export function buildActorNotRunnableGuidance(
`;
}

/**
* Build text and structured response for actor details.
* Pure/sync: the caller pre-resolves `mcpToolsMessage` when `output.mcpTools` is true.
*/
/** Build text and structured response for actor details. */
export function buildActorDetailsTextResponse(options: {
details: ActorDetailsResult;
output: ResolvedOutputOptions;
actorOutputSchema?: Record<string, unknown> | null;
mcpToolsMessage?: string;
serverInterfaceMessage?: string;
linkContext?: ConsoleLinkContext;
}): {
texts: string[];
structuredContent: Record<string, unknown>;
} {
const { details, output, actorOutputSchema, mcpToolsMessage, serverInterfaceMessage, linkContext } = options;
const { details, output, actorOutputSchema, serverInterfaceMessage, linkContext } = options;

const actorUrl =
buildConsoleActorUrl(linkContext, details.actorInfo.id) ??
Expand Down Expand Up @@ -235,10 +229,6 @@ export function buildActorDetailsTextResponse(options: {
}
}

if (mcpToolsMessage) {
texts.push(mcpToolsMessage);
}

if (serverInterfaceMessage) texts.push(serverInterfaceMessage);

if (linkContext) {
Expand All @@ -250,7 +240,6 @@ export function buildActorDetailsTextResponse(options: {
readme: resolvedReadme?.content,
inputSchema: output.inputSchema ? details.inputSchema : undefined,
outputSchema: output.outputSchema ? (actorOutputSchema ?? {}) : undefined,
mcpTools: output.mcpTools && mcpToolsMessage ? mcpToolsMessage : undefined,
serverInterface: serverInterfaceMessage,
};

Expand All @@ -276,10 +265,9 @@ export async function buildFetchActorDetailsResult(toolArgs: InternalToolArgs):
const actorName = fixActorNameInputAndLog(parsed.actor, { mcpSessionId, route: HELPER_TOOLS.ACTOR_GET_DETAILS });

const resolvedOutput = resolveOutputOptions(parsed.output);
// Skip the /users/me round-trip when pricing isn't rendered (e.g. inputSchema-only
// or mcpTools-only requests). In that case `userTier` is only used to fill the
// placeholder `{ model: 'FREE', userTier }` in the structured card, where it's never
// read, so defaulting to 'FREE' is safe and saves a request.
// Skip the /users/me round-trip when pricing isn't rendered (e.g. inputSchema-only requests). In that case
// `userTier` is only used to fill the placeholder `{ model: 'FREE', userTier }` in the structured card, where
// it's never read, so defaulting to 'FREE' is safe and saves a request.
const userPlanTier = resolvedOutput.pricing
? (await getUserInfoCached(apifyToken, apifyClient)).userPlanTier
: 'FREE';
Expand Down Expand Up @@ -307,17 +295,13 @@ export async function buildFetchActorDetailsResult(toolArgs: InternalToolArgs):
? await actorStore.getActorOutputSchemaAsTypeObject(actorName).catch(() => null)
: null;
}
const mcpToolsMessage = resolvedOutput.mcpTools
? await getMcpToolsMessage(actorName, apifyClient, apifyToken, paymentProvider, mcpSessionId)
: undefined;

// NOTE: Data duplication between texts and structuredContent is intentional and required.
// Some MCP clients only read text content, while others only read structured content.
const { texts, structuredContent } = buildActorDetailsTextResponse({
details,
output: resolvedOutput,
actorOutputSchema,
mcpToolsMessage,
serverInterfaceMessage: serverInterface.text,
linkContext,
});
Expand Down
Loading
Loading