Skip to content

Commit 24c5e0d

Browse files
committed
feat: Update tool description
1 parent 4fefb7f commit 24c5e0d

13 files changed

+197
-95
lines changed

src/tools/actor.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ const callActorArgs = z.object({
302302
.describe('The name of the Actor to call. For example, "apify/rag-web-browser".'),
303303
step: z.enum(['info', 'call'])
304304
.default('info')
305-
.describe(`Step to perform: "info" to get Actor details and input schema (required first step), "call" to execute the Actor (only after getting info).`),
305+
.describe(`Step to perform: "info" to get Actor details and input schema (required first step), "call" to run the Actor (only after getting info).`),
306306
input: z.object({}).passthrough()
307307
.optional()
308308
.describe(`The input JSON to pass to the Actor. For example, {"query": "apify", "maxResults": 5, "outputFormats": ["markdown"]}. Required only when step is "call".`),
@@ -325,15 +325,23 @@ export const callActor: ToolEntry = {
325325
tool: {
326326
name: HelperTools.ACTOR_CALL,
327327
actorFullName: HelperTools.ACTOR_CALL,
328-
description: `Call any Actor from Apify Store - two-step process
329-
This tool uses a mandatory two-step process to safely call any Actor from the Apify store.
328+
description: `Call any Actor from the Apify Store using a mandatory two-step workflow.
329+
This ensures you first get the Actor’s input schema and details before executing it safely.
330330
331-
USAGE:
332-
• ONLY for Actors that are NOT available as dedicated tools
333-
• If a dedicated tool exists (e.g., ${actorNameToToolName('apify/rag-web-browser')}), use that instead
331+
There are two ways to run Actors:
332+
1. Dedicated Actor tools (e.g., ${actorNameToToolName('apify/rag-web-browser')}): These are pre-configured tools, offering a simpler and more direct experience.
333+
2. Generic call-actor tool (${HelperTools.ACTOR_CALL}): Use this when a dedicated tool is not available or when you want to run any Actor dynamically. This tool is especially useful if you do not want to add specific tools or your client does not support dynamic tool registration.
334+
335+
**Important:**
334336
335-
MANDATORY TWO-STEP WORKFLOW:
337+
A successful run returns a \`datasetId\` (the Actor's output stored as an Apify dataset) and a short preview of items.
338+
To fetch the full output, use the ${HelperTools.ACTOR_OUTPUT_GET} tool with the \`datasetId\`.
339+
340+
USAGE:
341+
- Always use dedicated tools when available (e.g., ${actorNameToToolName('apify/rag-web-browser')})
342+
- Use the generic call-actor tool only if a dedicated tool does not exist for your Actor.
336343
344+
MANDATORY TWO-STEP-WORKFLOW:
337345
Step 1: Get Actor Info (step="info", default)
338346
- First call this tool with step="info" to get Actor details and input schema
339347
- This returns the Actor description, documentation, and required input schema
@@ -344,7 +352,8 @@ Step 2: Call Actor (step="call")
344352
- This calls and runs the Actor. It will create an output as an Apify dataset (with datasetId).
345353
- This step returns a dataset preview, typically JSON-formatted tabular data.
346354
347-
The step parameter enforces this workflow - you cannot call an Actor without first getting its info.`,
355+
EXAMPLES:
356+
- user_input: Get instagram posts using apify/instagram-scraper`,
348357
inputSchema: zodToJsonSchema(callActorArgs),
349358
ajvValidate: ajv.compile({
350359
...zodToJsonSchema(callActorArgs),

src/tools/dataset.ts

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,17 @@ export const getDataset: ToolEntry = {
4646
tool: {
4747
name: HelperTools.DATASET_GET,
4848
actorFullName: HelperTools.DATASET_GET,
49-
description: 'Dataset is a collection of structured data created by an Actor run. '
50-
+ 'Returns information about dataset object with metadata (itemCount, schema, fields, stats). '
51-
+ `Fields describe the structure of the dataset and can be used to filter the data with the ${HelperTools.DATASET_GET_ITEMS} tool. `
52-
+ 'Note: itemCount updates may have 5s delay.'
53-
+ 'The dataset can be accessed with the dataset URL: GET: https://api.apify.com/v2/datasets/:datasetId',
49+
description: `Get metadata for a dataset (collection of structured data created by an Actor run).
50+
The results will include dataset details such as itemCount, schema, fields, and stats.
51+
Use fields to understand structure for filtering with ${HelperTools.DATASET_GET_ITEMS}.
52+
Note: itemCount updates may be delayed by up to ~5 seconds.
53+
54+
USAGE:
55+
- Use when you need dataset metadata to understand its structure before fetching items.
56+
57+
EXAMPLES:
58+
- user_input: Show info for dataset 8TtYhCwKzQeQk7dJx
59+
- user_input: What fields does username~my-dataset have?`,
5460
inputSchema: zodToJsonSchema(getDatasetArgs),
5561
ajvValidate: ajv.compile(zodToJsonSchema(getDatasetArgs)),
5662
call: async (toolArgs) => {
@@ -74,16 +80,18 @@ export const getDatasetItems: ToolEntry = {
7480
tool: {
7581
name: HelperTools.DATASET_GET_ITEMS,
7682
actorFullName: HelperTools.DATASET_GET_ITEMS,
77-
description: 'Returns dataset items with pagination support. '
78-
+ 'Items can be sorted (newest to oldest) and filtered (clean mode skips empty items and hidden fields). '
79-
+ 'Supports field selection - include specific fields or exclude unwanted ones using comma-separated lists. '
80-
+ 'For nested objects, you must first flatten them using the flatten parameter before accessing their fields. '
81-
+ 'Example: To get URLs from items like [{"metadata":{"url":"example.com"}}], '
82-
+ 'use flatten="metadata" and then fields="metadata.url". '
83-
+ 'The flattening transforms nested objects into dot-notation format '
84-
+ '(e.g. {"metadata":{"url":"x"}} becomes {"metadata.url":"x"}). '
85-
+ 'Retrieve only the fields you need, reducing the response size and improving performance. '
86-
+ 'The response includes total count, offset, limit, and items array.',
83+
description: `Retrieve dataset items with pagination, sorting, and field selection.
84+
Use clean=true to skip empty items and hidden fields. Include or omit fields using comma-separated lists.
85+
For nested objects, first flatten them (e.g., flatten="metadata"), then reference nested fields via dot notation (e.g., fields="metadata.url").
86+
87+
The results will include items along with pagination info (limit, offset) and total count.
88+
89+
USAGE:
90+
- Use when you need to read data from a dataset (all items or only selected fields).
91+
92+
EXAMPLES:
93+
- user_input: Get first 100 items from dataset 8TtYhCwKzQeQk7dJx
94+
- user_input: Get only metadata.url and title from dataset username~my-dataset (flatten metadata)`,
8795
inputSchema: zodToJsonSchema(getDatasetItemsArgs),
8896
ajvValidate: ajv.compile(zodToJsonSchema(getDatasetItemsArgs)),
8997
call: async (toolArgs) => {
@@ -136,9 +144,16 @@ export const getDatasetSchema: ToolEntry = {
136144
tool: {
137145
name: HelperTools.DATASET_SCHEMA_GET,
138146
actorFullName: HelperTools.DATASET_SCHEMA_GET,
139-
description: 'Generates a JSON schema from dataset items. '
140-
+ 'The schema describes the structure of the data in the dataset, which can be used for validation, documentation, or data processing.'
141-
+ 'Since the dataset can be large it is convenient to understand the structure of the dataset before getting dataset items.',
147+
description: `Generate a JSON schema from a sample of dataset items.
148+
The schema describes the structure of the data and can be used for validation, documentation, or processing.
149+
Use this to understand the dataset before fetching many items.
150+
151+
USAGE:
152+
- Use when you need to infer the structure of dataset items for downstream processing or validation.
153+
154+
EXAMPLES:
155+
- user_input: Generate schema for dataset 8TtYhCwKzQeQk7dJx using 10 items
156+
- user_input: Show schema of username~my-dataset (clean items only)`,
142157
inputSchema: zodToJsonSchema(getDatasetSchemaArgs),
143158
ajvValidate: ajv.compile(zodToJsonSchema(getDatasetSchemaArgs)),
144159
call: async (toolArgs) => {

src/tools/dataset_collection.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,18 @@ export const getUserDatasetsList: ToolEntry = {
3030
tool: {
3131
name: HelperTools.DATASET_LIST_GET,
3232
actorFullName: HelperTools.DATASET_LIST_GET,
33-
description: 'Lists datasets (collections of Actor run data). '
34-
+ 'Actor runs automatically produce unnamed datasets (use unnamed=true to include these). '
35-
+ 'Users can also create named datasets manually. '
36-
+ 'Each dataset includes itemCount, access settings, and usage stats (readCount, writeCount). '
37-
+ 'Results are sorted by createdAt in ascending order (use desc=true for descending). '
38-
+ 'Supports pagination with limit (max 20) and offset parameters.',
33+
description: `List datasets (collections of Actor run data) for the authenticated user.
34+
Actor runs automatically produce unnamed datasets (set unnamed=true to include them). Users can also create named datasets.
35+
36+
The results will include datasets with itemCount, access settings, and usage stats, sorted by createdAt (ascending by default).
37+
Use limit (max 20), offset, and desc to paginate and sort.
38+
39+
USAGE:
40+
- Use when you need to browse available datasets (named or unnamed) to locate data.
41+
42+
EXAMPLES:
43+
- user_input: List my last 10 datasets (newest first)
44+
- user_input: List unnamed datasets`,
3945
inputSchema: zodToJsonSchema(getUserDatasetsListArgs),
4046
ajvValidate: ajv.compile(zodToJsonSchema(getUserDatasetsListArgs)),
4147
call: async (toolArgs) => {

src/tools/fetch-actor-details.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ export const fetchActorDetailsTool: ToolEntry = {
1717
type: 'internal',
1818
tool: {
1919
name: HelperTools.ACTOR_GET_DETAILS,
20-
description: `Get detailed information about an Actor by its ID or full name.
21-
This tool returns title, description, URL, README (Actor's documentation), input schema, and usage statistics.
22-
The Actor name is always composed of "username/name", for example, "apify/rag-web-browser".
23-
Present Actor information in user-friendly format as an Actor card.
20+
description: `Get detailed information about an Actor by its ID or full name (format: "username/name", e.g., "apify/rag-web-browser").
21+
This returns the Actor’s title, description, URL, README (documentation), input schema, pricing/usage information, and basic stats.
22+
Present the information in a user-friendly Actor card.
23+
2424
USAGE:
25-
- Use when user asks about an Actor its details, description, input schema, etc.
25+
- Use when a user asks about an Actor’s details, input schema, README, or how to use it.
26+
2627
EXAMPLES:
2728
- user_input: How to use apify/rag-web-browser
28-
- user_input: What is the input schema for apify/rag-web-browser,
29-
- user_input: What is pricing of apify/instagram-scraper?`,
29+
- user_input: What is the input schema for apify/rag-web-browser?
30+
- user_input: What is the pricing for apify/instagram-scraper?`,
3031
inputSchema: zodToJsonSchema(fetchActorDetailsToolArgsSchema),
3132
ajvValidate: ajv.compile(zodToJsonSchema(fetchActorDetailsToolArgsSchema)),
3233
call: async (toolArgs) => {

src/tools/fetch-apify-docs.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ export const fetchApifyDocsTool: ToolEntry = {
1919
type: 'internal',
2020
tool: {
2121
name: HelperTools.DOCS_FETCH,
22-
description: `Apify documentation fetch tool. This tool allows you to fetch the full content of an Apify documentation page by its URL.`,
22+
description: `Fetch the full content of an Apify documentation page by its URL.
23+
Use this after finding a relevant page with the ${HelperTools.DOCS_SEARCH} tool.
24+
25+
USAGE:
26+
- Use when you need the complete content of a specific docs page for detailed answers.
27+
28+
EXAMPLES:
29+
- user_input: Fetch https://docs.apify.com/platform/actors/running#builds
30+
- user_input: Fetch https://docs.apify.com/academy`,
2331
args: fetchApifyDocsToolArgsSchema,
2432
inputSchema: zodToJsonSchema(fetchApifyDocsToolArgsSchema),
2533
ajvValidate: ajv.compile(zodToJsonSchema(fetchApifyDocsToolArgsSchema)),

src/tools/get-actor-output.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,23 @@ export const getActorOutput: ToolEntry = {
6868
tool: {
6969
name: HelperTools.ACTOR_OUTPUT_GET,
7070
actorFullName: HelperTools.ACTOR_OUTPUT_GET,
71-
description: `Fetch the dataset of a specific Actor run based on datasetId.
72-
You can also retrieve only specific fields from the output if needed.
71+
description: `Retrieve the output dataset items of a specific Actor run using its datasetId.
72+
You can select specific fields to return (supports dot notation like "crawl.statusCode") and paginate results with offset and limit.
73+
This tool is a simplified version of the get-dataset-items tool, focused on Actor run outputs.
74+
75+
The results will include the dataset items from the specified dataset. If you provide fields, only those fields will be included (nested fields supported via dot notation).
76+
77+
You can obtain the datasetId from an Actor run (e.g., after calling an Actor with the call-actor tool) or from the Apify Console (Runs → Run details → Dataset ID).
7378
7479
USAGE:
75-
- Use this tool to get Actor dataset outside of the preview, or to access fields from the Actor output
76-
dataset schema that are not included in the preview.
80+
- Use when you need to read Actor output data (full items or selected fields), especially when preview does not include all fields.
7781
7882
EXAMPLES:
79-
- user_input: Get data of my last Actor run?
80-
- user_input: Get number_of_likes from my dataset?
83+
- user_input: Get data of my last Actor run
84+
- user_input: Get number_of_likes from my dataset
85+
- user_input: Return only crawl.statusCode and url from dataset 8TtYhCwKzQeQk7dJx
8186
82-
Note: This tool is automatically included if the Apify MCP Server is configured with any Actor tools
83-
(e.g. "apify-slash-rag-web-browser") or tools that can interact with Actors (e.g. "call-actor", "add-actor").`,
87+
Note: This tool is automatically included if the Apify MCP Server is configured with any Actor tools (e.g., "apify-slash-rag-web-browser") or tools that can interact with Actors (e.g., "call-actor", "add-actor").`,
8488
inputSchema: zodToJsonSchema(getActorOutputArgs),
8589
/**
8690
* Allow additional properties for Skyfire mode to pass `skyfire-pay-id`.

src/tools/get-html-skeleton.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ export const getHtmlSkeleton: ToolEntry = {
4141
tool: {
4242
name: HelperTools.GET_HTML_SKELETON,
4343
actorFullName: HelperTools.GET_HTML_SKELETON,
44-
description: `Retrieves the HTML skeleton (clean structure) from a given URL by stripping unwanted elements like scripts, styles, and non-essential attributes. This tool keeps only the core HTML structure, links, images, and data attributes for analysis. Supports optional JavaScript rendering for dynamic content and provides chunked output to handle large HTML. This tool is useful for building web scrapers and data extraction tasks where a clean HTML structure is needed for writing concrete selectors or parsers.`,
44+
description: `Retrieve the HTML skeleton (clean structure) of a webpage by stripping scripts, styles, and non-essential attributes.
45+
This keeps the core HTML structure, links, images, and data attributes for analysis. Supports optional JavaScript rendering for dynamic pages.
46+
47+
The results will include a chunked HTML skeleton if the content is large. Use the chunk parameter to paginate through the output.
48+
49+
USAGE:
50+
- Use when you need a clean HTML structure to design selectors or parsers for scraping.
51+
52+
EXAMPLES:
53+
- user_input: Get HTML skeleton for https://example.com
54+
- user_input: Get next chunk of HTML skeleton for https://example.com (chunk=2)`,
4555
inputSchema: zodToJsonSchema(getHtmlSkeletonArgs),
4656
ajvValidate: ajv.compile(zodToJsonSchema(getHtmlSkeletonArgs)),
4757
call: async (toolArgs) => {

src/tools/helpers.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ export const addTool: ToolEntry = {
1515
type: 'internal',
1616
tool: {
1717
name: HelperTools.ACTOR_ADD,
18-
description: `Add an Actor or MCP server to the available tools of the Apify MCP server.\n`
19-
+ 'A tool is an Actor or MCP server that can be called by the user.\n'
20-
+ 'Do not execute the tool, only add it and list it in the available tools.\n'
21-
+ 'For example, when a user wants to scrape a website, first search for relevant Actors\n'
22-
+ `using ${HelperTools.STORE_SEARCH} tool, and once the user selects one they want to use,\n`
23-
+ 'add it as a tool to the Apify MCP server.',
18+
description: `Add an Actor or MCP server to the Apify MCP Server as an available tool.
19+
This does not execute the Actor; it only registers it so it can be called later.
20+
21+
You can first discover Actors using the ${HelperTools.STORE_SEARCH} tool, then add the selected Actor as a tool.
22+
23+
USAGE:
24+
- Use when a user has chosen an Actor to work with and you need to make it available as a callable tool.
25+
26+
EXAMPLES:
27+
- user_input: Add apify/rag-web-browser as a tool
28+
- user_input: Add apify/instagram-scraper as a tool`,
2429
inputSchema: zodToJsonSchema(addToolArgsSchema),
2530
ajvValidate: ajv.compile(zodToJsonSchema(addToolArgsSchema)),
2631
// TODO: I don't like that we are passing apifyMcpServer and mcpServer to the tool

0 commit comments

Comments
 (0)