Skip to content

Commit d78d12a

Browse files
committed
fix: standardize tool description formatting with string concatenation
Replace inconsistent template literal indentation with string concatenation for all tool descriptions to ensure clean code and output text.
1 parent 56dcfb9 commit d78d12a

File tree

6 files changed

+42
-33
lines changed

6 files changed

+42
-33
lines changed

src/tools/actor.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,12 @@ export const callActor: ToolEntry = {
330330
return {
331331
content: [{
332332
type: 'text',
333-
text: `Actor '${actorName}' is not added. ${toolsText}
334-
To use this MCP server, specify the actors with the parameter, for example:
335-
?actors=apify/instagram-scraper,apify/website-content-crawler
336-
or with the CLI:
337-
--actors "apify/instagram-scraper,apify/website-content-crawler"
338-
You can only use actors that are included in the list; actors not in the list cannot be used.`,
333+
text: `Actor '${actorName}' is not added. ${toolsText}\n`
334+
+ 'To use this MCP server, specify the actors with the parameter, for example:\n'
335+
+ '?actors=apify/instagram-scraper,apify/website-content-crawler\n'
336+
+ 'or with the CLI:\n'
337+
+ '--actors "apify/instagram-scraper,apify/website-content-crawler"\n'
338+
+ 'You can only use actors that are included in the list; actors not in the list cannot be used.',
339339
}],
340340
};
341341
}

src/tools/get-actor-details.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,15 @@ export const getActorDetailsTool: ToolEntry = {
4646
type: 'internal',
4747
tool: {
4848
name: HelperTools.ACTOR_GET_DETAILS,
49-
description: `Retrieve information about an Actor by its ID or full name.
50-
The Actor name is always composed of "username/name", for example, "apify/rag-web-browser".
51-
This tool returns information about the Actor, including whether it is public or deprecated, when it was created or modified, the categories in which the Actor is listed, a description, a README (the Actor's documentation), the input schema, and usage statistics - such as how many users are using it and the number of failed runs of the Actor.
52-
For example, use this tool when a user wants to know more about a specific Actor or wants to use optional or advanced parameters of the Actor that are not listed in the default Actor tool input schema - so you know the details and how to pass them.`,
49+
description: `Retrieve information about an Actor by its ID or full name.\n`
50+
+ 'The Actor name is always composed of "username/name", for example, "apify/rag-web-browser".\n'
51+
+ 'This tool returns information about the Actor, including whether it is public or deprecated, '
52+
+ 'when it was created or modified, the categories in which the Actor is listed, a description, '
53+
+ 'a README (the Actor\'s documentation), the input schema, and usage statistics - such as how many users are using it '
54+
+ 'and the number of failed runs of the Actor.\n'
55+
+ 'For example, use this tool when a user wants to know more about a specific Actor or wants to use optional '
56+
+ 'or advanced parameters of the Actor that are not listed in the default Actor tool input schema - '
57+
+ 'so you know the details and how to pass them.',
5358
inputSchema: zodToJsonSchema(getActorDetailsToolArgsSchema),
5459
ajvValidate: ajv.compile(zodToJsonSchema(getActorDetailsToolArgsSchema)),
5560
call: async (toolArgs) => {

src/tools/helpers.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ export const addTool: ToolEntry = {
3939
type: 'internal',
4040
tool: {
4141
name: HelperTools.ACTOR_ADD,
42-
description:
43-
`Add an Actor or MCP server to the available tools of the Apify MCP server.
44-
A tool is an Actor or MCP server that can be called by the user.
45-
Do not execute the tool, only add it and list it in the available tools.
46-
For example, when a user wants to scrape a website, first search for relevant Actors
47-
using ${HelperTools.STORE_SEARCH} tool, and once the user selects one they want to use,
48-
add it as a tool to the Apify MCP server.`,
42+
description: `Add an Actor or MCP server to the available tools of the Apify MCP server.\n`
43+
+ 'A tool is an Actor or MCP server that can be called by the user.\n'
44+
+ 'Do not execute the tool, only add it and list it in the available tools.\n'
45+
+ 'For example, when a user wants to scrape a website, first search for relevant Actors\n'
46+
+ `using ${HelperTools.STORE_SEARCH} tool, and once the user selects one they want to use,\n`
47+
+ 'add it as a tool to the Apify MCP server.',
4948
inputSchema: zodToJsonSchema(addToolArgsSchema),
5049
ajvValidate: ajv.compile(zodToJsonSchema(addToolArgsSchema)),
5150
// TODO: I don't like that we are passing apifyMcpServer and mcpServer to the tool
@@ -120,9 +119,10 @@ export const helpTool: ToolEntry = {
120119
type: 'internal',
121120
tool: {
122121
name: HelperTools.APIFY_MCP_HELP_TOOL,
123-
description: `Helper tool to get information on how to use and troubleshoot the Apify MCP server.
124-
This tool always returns the same help message with information about the server and how to use it.
125-
ALWAYS CALL THIS TOOL AT THE BEGINNING OF THE CONVERSATION SO THAT YOU HAVE INFORMATION ABOUT THE APIFY MCP SERVER IN CONTEXT, OR WHEN YOU ENCOUNTER ANY ISSUES WITH THE MCP SERVER OR ITS TOOLS.`,
122+
description: `Helper tool to get information on how to use and troubleshoot the Apify MCP server.\n`
123+
+ 'This tool always returns the same help message with information about the server and how to use it.\n'
124+
+ 'ALWAYS CALL THIS TOOL AT THE BEGINNING OF THE CONVERSATION SO THAT YOU HAVE INFORMATION ABOUT THE APIFY MCP SERVER IN CONTEXT, '
125+
+ 'OR WHEN YOU ENCOUNTER ANY ISSUES WITH THE MCP SERVER OR ITS TOOLS.',
126126
inputSchema: zodToJsonSchema(helpToolArgsSchema),
127127
ajvValidate: ajv.compile(zodToJsonSchema(helpToolArgsSchema)),
128128
call: async () => {

src/tools/run_collection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export const getUserRunsList: ToolEntry = {
3232
tool: {
3333
name: HelperTools.ACTOR_RUN_LIST_GET,
3434
actorFullName: HelperTools.ACTOR_RUN_LIST_GET,
35-
description: `Gets a paginated list of Actor runs with run details, datasetId, and keyValueStoreId.
36-
Filter by status: READY (not allocated), RUNNING (executing), SUCCEEDED (finished), FAILED (failed),
37-
TIMING-OUT (timing out), TIMED-OUT (timed out), ABORTING (being aborted), ABORTED (aborted).`,
35+
description: `Gets a paginated list of Actor runs with run details, datasetId, and keyValueStoreId.\n`
36+
+ 'Filter by status: READY (not allocated), RUNNING (executing), SUCCEEDED (finished), FAILED (failed),\n'
37+
+ 'TIMING-OUT (timing out), TIMED-OUT (timed out), ABORTING (being aborted), ABORTED (aborted).',
3838
inputSchema: zodToJsonSchema(getUserRunsListArgs),
3939
ajvValidate: ajv.compile(zodToJsonSchema(getUserRunsListArgs)),
4040
call: async (toolArgs) => {

src/tools/search-apify-docs.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ export const searchApifyDocsTool: ToolEntry = {
3030
type: 'internal',
3131
tool: {
3232
name: HelperTools.DOCS_SEARCH,
33-
description: `Apify documentation search tool. This tool allows you to search the Apify documentation using Algolia's full-text search.
34-
You can use it to find relevant documentation pages based on keywords. The results will include the URL of the documentation page, a fragment identifier (if available), and a limited piece of content that matches the search query. You can then fetch the full content of the document using the ${HelperTools.DOCS_FETCH} tool by providing the URL.
35-
Use this tool when a user asks for help with Apify documentation or when you need to find relevant documentation pages based on keywords. For example, when a user wants to build an Apify Actor, you can search "How to build Actors" to find relevant guidance.`,
33+
description: `Apify documentation search tool. This tool allows you to search the Apify documentation using Algolia's full-text search.\n`
34+
+ 'You can use it to find relevant documentation pages based on keywords. The results will include the URL of the documentation page, '
35+
+ 'a fragment identifier (if available), and a limited piece of content that matches the search query. '
36+
+ `You can then fetch the full content of the document using the ${HelperTools.DOCS_FETCH} tool by providing the URL.\n`
37+
+ 'Use this tool when a user asks for help with Apify documentation or when you need to find relevant documentation pages based on keywords. '
38+
+ 'For example, when a user wants to build an Apify Actor, you can search "How to build Actors" to find relevant guidance.',
3639
args: searchApifyDocsToolArgsSchema,
3740
inputSchema: zodToJsonSchema(searchApifyDocsToolArgsSchema),
3841
ajvValidate: ajv.compile(zodToJsonSchema(searchApifyDocsToolArgsSchema)),

src/tools/store_collection.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,14 @@ export const searchActors: ToolEntry = {
9797
type: 'internal',
9898
tool: {
9999
name: HelperTools.STORE_SEARCH,
100-
description: `Discover available Actors or MCP servers (which are also considered Actors in the context of Apify) in the Apify Store.
101-
This tool uses full-text search, so you MUST use simple space-separated keywords, such as "web scraping", "data extraction", or "playwright browser mcp".
102-
This tool returns a list of Actors with basic information, including descriptions, pricing models, usage statistics, and user ratings.
103-
Prefer Actors with more users, stars, and runs.
104-
You may need to use this tool several times to find the right Actor.
105-
Limit the number of results returned, but ensure that relevant results are included.
106-
This is not a general search tool; it is designed specifically to search for Actors in the Apify Store.`,
100+
description: `Discover available Actors or MCP servers (which are also considered Actors in the context of Apify) in the Apify Store.\n`
101+
+ 'This tool uses full-text search, so you MUST use simple space-separated keywords, such as "web scraping", '
102+
+ '"data extraction", or "playwright browser mcp".\n'
103+
+ 'This tool returns a list of Actors with basic information, including descriptions, pricing models, usage statistics, and user ratings.\n'
104+
+ 'Prefer Actors with more users, stars, and runs.\n'
105+
+ 'You may need to use this tool several times to find the right Actor.\n'
106+
+ 'Limit the number of results returned, but ensure that relevant results are included.\n'
107+
+ 'This is not a general search tool; it is designed specifically to search for Actors in the Apify Store.',
107108
inputSchema: zodToJsonSchema(searchActorsArgsSchema),
108109
ajvValidate: ajv.compile(zodToJsonSchema(searchActorsArgsSchema)),
109110
call: async (toolArgs) => {

0 commit comments

Comments
 (0)