Skip to content

Commit 43e6dab

Browse files
authored
fix: Update search tool description (#82)
1 parent de1c1d8 commit 43e6dab

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

src/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const SERVER_VERSION = '1.0.0';
2222
export const USER_AGENT_ORIGIN = 'Origin/mcp-server';
2323

2424
export enum HelperTools {
25-
SEARCH = 'search',
25+
SEARCH_ACTOR = 'search-actor',
2626
ADD_TOOL = 'add-tool',
2727
REMOVE_TOOL = 'remove-tool',
2828
GET_TOOL_DETAILS = 'get-tool-details',

src/tools/helpers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ import { actorNameToToolName } from './utils.js';
1010
const ajv = new Ajv({ coerceTypes: 'array', strict: false });
1111
export const AddToolArgsSchema = z.object({
1212
actorName: z.string()
13-
.describe('Add a tool to available tools by Tool ID or tool full name.'
13+
.describe('Add a tool, Actor or MCP-Server to available tools by Actor ID or tool full name.'
1414
+ 'Tool name is always composed from `username/name`'),
1515
});
1616
export const addTool: ToolWrap = {
1717
type: 'internal',
1818
tool: {
1919
name: HelperTools.ADD_TOOL,
20-
description: 'Add a tool to available tools by Actor ID or Actor name. '
20+
description: 'Add a tool, Actor or MCP-Server to available tools by Actor ID or Actor name. '
21+
+ 'A tool is an Actor or MCP-Server that can be called by the user'
2122
+ 'Do not execute the tool, only add it and list it in available tools. '
22-
+ 'Never run the tool without user consent! '
2323
+ 'For example, add a tool with username/name when user wants to scrape data from a website.',
2424
inputSchema: zodToJsonSchema(AddToolArgsSchema),
2525
ajvValidate: ajv.compile(zodToJsonSchema(AddToolArgsSchema)),
@@ -49,7 +49,7 @@ export const removeTool: ToolWrap = {
4949
type: 'internal',
5050
tool: {
5151
name: HelperTools.REMOVE_TOOL,
52-
description: 'Remove tool by name from available tools. '
52+
description: 'Remove a tool, an Actor or MCP-Server by name from available tools. '
5353
+ 'For example, when user says, I do not need a tool username/name anymore',
5454
inputSchema: zodToJsonSchema(RemoveToolArgsSchema),
5555
ajvValidate: ajv.compile(zodToJsonSchema(RemoveToolArgsSchema)),

src/tools/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { callActorGetDataset, getActorsAsTools } from './actor.js';
33
import { actorDefinitionTool } from './build.js';
44
import { addTool, removeTool } from './helpers.js';
5-
import { searchTool } from './store_collection.js';
5+
import { searchActorTool } from './store_collection.js';
66

77
// Export only the tools that are being used
8-
export { addTool, removeTool, actorDefinitionTool, searchTool, getActorsAsTools, callActorGetDataset };
8+
export { addTool, removeTool, actorDefinitionTool, searchActorTool as searchTool, getActorsAsTools, callActorGetDataset };

src/tools/store_collection.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,26 @@ export const SearchToolArgsSchema = z.object({
5959
.describe('The number of elements that should be skipped at the start. Default value is 0.'),
6060
search: z.string()
6161
.default('')
62-
.describe('String of key words to search by. '
62+
.describe('String of key words to search Actors by. '
6363
+ 'Searches the title, name, description, username, and readme of an Actor.'
6464
+ 'Only key word search is supported, no advanced search.'
6565
+ 'Always prefer simple keywords over complex queries.'),
6666
category: z.string()
6767
.default('')
6868
.describe('Filters the results by the specified category.'),
6969
});
70-
export const searchTool: ToolWrap = {
70+
export const searchActorTool: ToolWrap = {
7171
type: 'internal',
7272
tool: {
73-
name: HelperTools.SEARCH,
74-
actorFullName: HelperTools.SEARCH,
75-
description: `Discover available Actors using full text search using keywords.`
76-
+ `Users try to discover Actors using free form query in this case search query needs to be converted to full text search. `
77-
+ `Prefer Actors from Apify as they are generally more reliable and have better support. `
73+
name: HelperTools.SEARCH_ACTOR,
74+
actorFullName: HelperTools.SEARCH_ACTOR,
75+
description: `Discover available Actors or MCP-Servers in Apify Store using full text search using keywords.`
76+
+ `Users try to discover Actors using free form query in this case search query must be converted to full text search. `
7877
+ `Returns a list of Actors with name, description, run statistics, pricing, starts, and URL. `
7978
+ `You perhaps need to use this tool several times to find the right Actor. `
80-
+ `Limit number of results returned but ensure that relevant results are returned. `,
79+
+ `You should prefer simple keywords over complex queries. `
80+
+ `Limit number of results returned but ensure that relevant results are returned. `
81+
+ `This is not a general search tool, it is designed to search for Actors in Apify Store. `,
8182
inputSchema: zodToJsonSchema(SearchToolArgsSchema),
8283
ajvValidate: ajv.compile(zodToJsonSchema(SearchToolArgsSchema)),
8384
call: async (toolArgs) => {

tests/actor-server-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('ApifyMcpServer initialization', () => {
5959

6060
const toolNames = server.getToolNames();
6161
expect(toolNames).toEqual([
62-
HelperTools.SEARCH,
62+
HelperTools.SEARCH_ACTOR,
6363
HelperTools.GET_TOOL_DETAILS,
6464
HelperTools.ADD_TOOL,
6565
HelperTools.REMOVE_TOOL,

0 commit comments

Comments
 (0)