Skip to content

Conversation

@MichalKalita
Copy link
Contributor

closes #184

@jirispilka
Copy link
Collaborator

@MichalKalita please ask for review only once it is ready for a review.

For example, I'm getting bunch of errors when running npm run build

npm run build                   

> @apify/[email protected] build
> tsc -b src

src/main.ts:59:68 - error TS2345: Argument of type '{}' is not assignable to parameter of type 'Record<string, unknown>'.
  Index signature for type 'string' is missing in type '{}'.

59     const { items } = await callActorGetDataset(input.debugActor!, input.debugActorInput!, process.env.APIFY_TOKEN, options);
                                                                      ~~~~~~~~~~~~~~~~~~~~~~

src/tools/actor.ts:13:5 - error TS2305: Module '"../const.js"' has no exported member 'ADVANCED_INPUT_KEY'.

13     ADVANCED_INPUT_KEY,
       ~~~~~~~~~~~~~~~~~~

src/tools/actor.ts:66:19 - error TS2698: Spread types may only be created from object types.

66         input = { ...advancedInput, ...rest };
                     ~~~~~~~~~~~~~~~~

src/tools/build.ts:9:35 - error TS2305: Module '"../const.js"' has no exported member 'ADVANCED_INPUT_KEY'.

9 import { ACTOR_README_MAX_LENGTH, ADVANCED_INPUT_KEY, HelperTools } from '../const.js';
                                    ~~~~~~~~~~~~~~~~~~

src/utils/tools.ts:1:10 - error TS2305: Module '"../const.js"' has no exported member 'ADVANCED_INPUT_KEY'.

1 import { ADVANCED_INPUT_KEY } from '../const.js';
           ~~~~~~~~~~~~~~~~~~

@MichalKalita
Copy link
Contributor Author

@jirispilka It's some kind of mistake. I haven't asked for review yet. This pull request is a draft.

@jirispilka
Copy link
Collaborator

@jirispilka It's some kind of mistake. I haven't asked for review yet. This pull request is a draft.

ok, no problem :) . I was just eager to check and then a bit disappointed that it is not working

- Introduced `McpOptions` type for input parameters.
- Replaced the previous input processing logic with Zod schema validation for better type safety and clarity.
- Updated related functions and types to align with the new schema.
- Added a new constant `ADVANCED_INPUT_KEY` in `const.ts` for future use.
@github-actions github-actions bot added t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics. labels Aug 11, 2025
@MichalKalita MichalKalita marked this pull request as ready for review August 11, 2025 12:09
Copy link
Contributor

@MQ37 MQ37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went through it and I like the refactored and simplified parts - mainly the ToolEntry type. There is couple of nits and one important question regarding the caching that needs clarification before merging.

Note: Please also be sure to document this in docs.apify.com and this repo README.md.

expectToolNamesToContain(names, actors.map((actor) => actorNameToToolName(actor)));
expect(names).toMatchInlineSnapshot(`
[
"get-actor-details",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change the tool names we need to update the test, this is fragile, I prefer the previous logic - it was not nice but was definitely more robust.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a problem with this tests when I worked on this issue. Tests failed and I don't know why. This test is really simple and if fails, is easy to find where is a problem, what missing and what should not be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All snapshots can be updated using the command npx vitest tests --update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this added complexity. But if you are both @jirispilka and @MichalKalita for using this then I am fine with keeping that.

const schemaID = getToolSchemaID(actorDefinitionPruned.actorFullName);
if (actorDefinitionPruned.input && 'properties' in actorDefinitionPruned.input && actorDefinitionPruned.input) {
actorDefinitionPruned.input.properties = transformActorInputSchemaProperties(actorDefinitionPruned.input);
actorDefinitionPruned.input.properties = transformActorInputSchemaProperties(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment—no need to fix now, maybe later.
We currently have three things there: basic, full, and pruned (though “pruned” is a bit misleading). I know it’s a modified schema based on some transformation, but it could also be a schema without advancedInput.

Copy link
Collaborator

@jirispilka jirispilka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(somehow IDE crashed when submitting the review)

I like it.

But apart from the comments from MQ and my own comments, IMO we’re missing some functionality.

When fullSchema is false, the LLM doesn’t know there are advanced parameters available.

I think we discussed the following flow:

  • Provide the basic schema, but include the advanced attributes in the description.
  • Let the LLM know that other attributes exist and that it can fetch the full schema to call an Actor with them.
  • Essentially, the LLM would first do get-schema and then call-actor. This is inefficient, but it would solve some cases.

And the assumption was that:

  • 90% use-cases are solved with basic schema
  • 10% use-cases, either you opt for fullSchema or you will do get-schema and call-actor (yes, you need to have this feature enabled)

@jirispilka
Copy link
Collaborator

jirispilka commented Aug 12, 2025

One more thing, we should document it in the README (query parameter + description)

And we'll need to include it in docs.apify.com, and mcp-apify-server (but that's for later)

@MichalKalita
Copy link
Contributor Author

Closing this PR, more details in #184 (comment)

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

Labels

t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for exposing a subset of input schema attributes, with the option to fetch all attributes when needed

3 participants