diff --git a/src/const.ts b/src/const.ts index 20decefe..87dd84be 100644 --- a/src/const.ts +++ b/src/const.ts @@ -22,7 +22,7 @@ export const SERVER_VERSION = '1.0.0'; export const USER_AGENT_ORIGIN = 'Origin/mcp-server'; export enum HelperTools { - SEARCH = 'search', + SEARCH_ACTOR = 'search-actor', ADD_TOOL = 'add-tool', REMOVE_TOOL = 'remove-tool', GET_TOOL_DETAILS = 'get-tool-details', diff --git a/src/tools/helpers.ts b/src/tools/helpers.ts index 2b85ecc7..c4d7b4e2 100644 --- a/src/tools/helpers.ts +++ b/src/tools/helpers.ts @@ -10,16 +10,16 @@ import { actorNameToToolName } from './utils.js'; const ajv = new Ajv({ coerceTypes: 'array', strict: false }); export const AddToolArgsSchema = z.object({ actorName: z.string() - .describe('Add a tool to available tools by Tool ID or tool full name.' + .describe('Add a tool, Actor or MCP-Server to available tools by Actor ID or tool full name.' + 'Tool name is always composed from `username/name`'), }); export const addTool: ToolWrap = { type: 'internal', tool: { name: HelperTools.ADD_TOOL, - description: 'Add a tool to available tools by Actor ID or Actor name. ' + description: 'Add a tool, Actor or MCP-Server to available tools by Actor ID or Actor name. ' + + 'A tool is an Actor or MCP-Server that can be called by the user' + 'Do not execute the tool, only add it and list it in available tools. ' - + 'Never run the tool without user consent! ' + 'For example, add a tool with username/name when user wants to scrape data from a website.', inputSchema: zodToJsonSchema(AddToolArgsSchema), ajvValidate: ajv.compile(zodToJsonSchema(AddToolArgsSchema)), @@ -49,7 +49,7 @@ export const removeTool: ToolWrap = { type: 'internal', tool: { name: HelperTools.REMOVE_TOOL, - description: 'Remove tool by name from available tools. ' + description: 'Remove a tool, an Actor or MCP-Server by name from available tools. ' + 'For example, when user says, I do not need a tool username/name anymore', inputSchema: zodToJsonSchema(RemoveToolArgsSchema), ajvValidate: ajv.compile(zodToJsonSchema(RemoveToolArgsSchema)), diff --git a/src/tools/index.ts b/src/tools/index.ts index b6f141e0..ab11ff8e 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -2,7 +2,7 @@ import { callActorGetDataset, getActorsAsTools } from './actor.js'; import { actorDefinitionTool } from './build.js'; import { addTool, removeTool } from './helpers.js'; -import { searchTool } from './store_collection.js'; +import { searchActorTool } from './store_collection.js'; // Export only the tools that are being used -export { addTool, removeTool, actorDefinitionTool, searchTool, getActorsAsTools, callActorGetDataset }; +export { addTool, removeTool, actorDefinitionTool, searchActorTool as searchTool, getActorsAsTools, callActorGetDataset }; diff --git a/src/tools/store_collection.ts b/src/tools/store_collection.ts index f8c192bb..98577644 100644 --- a/src/tools/store_collection.ts +++ b/src/tools/store_collection.ts @@ -59,7 +59,7 @@ export const SearchToolArgsSchema = z.object({ .describe('The number of elements that should be skipped at the start. Default value is 0.'), search: z.string() .default('') - .describe('String of key words to search by. ' + .describe('String of key words to search Actors by. ' + 'Searches the title, name, description, username, and readme of an Actor.' + 'Only key word search is supported, no advanced search.' + 'Always prefer simple keywords over complex queries.'), @@ -67,17 +67,18 @@ export const SearchToolArgsSchema = z.object({ .default('') .describe('Filters the results by the specified category.'), }); -export const searchTool: ToolWrap = { +export const searchActorTool: ToolWrap = { type: 'internal', tool: { - name: HelperTools.SEARCH, - actorFullName: HelperTools.SEARCH, - description: `Discover available Actors using full text search using keywords.` - + `Users try to discover Actors using free form query in this case search query needs to be converted to full text search. ` - + `Prefer Actors from Apify as they are generally more reliable and have better support. ` + name: HelperTools.SEARCH_ACTOR, + actorFullName: HelperTools.SEARCH_ACTOR, + description: `Discover available Actors or MCP-Servers in Apify Store using full text search using keywords.` + + `Users try to discover Actors using free form query in this case search query must be converted to full text search. ` + `Returns a list of Actors with name, description, run statistics, pricing, starts, and URL. ` + `You perhaps need to use this tool several times to find the right Actor. ` - + `Limit number of results returned but ensure that relevant results are returned. `, + + `You should prefer simple keywords over complex queries. ` + + `Limit number of results returned but ensure that relevant results are returned. ` + + `This is not a general search tool, it is designed to search for Actors in Apify Store. `, inputSchema: zodToJsonSchema(SearchToolArgsSchema), ajvValidate: ajv.compile(zodToJsonSchema(SearchToolArgsSchema)), call: async (toolArgs) => { diff --git a/tests/actor-server-test.ts b/tests/actor-server-test.ts index ddeaa372..da30dfef 100644 --- a/tests/actor-server-test.ts +++ b/tests/actor-server-test.ts @@ -59,7 +59,7 @@ describe('ApifyMcpServer initialization', () => { const toolNames = server.getToolNames(); expect(toolNames).toEqual([ - HelperTools.SEARCH, + HelperTools.SEARCH_ACTOR, HelperTools.GET_TOOL_DETAILS, HelperTools.ADD_TOOL, HelperTools.REMOVE_TOOL,