Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions src/tools/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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)),
Expand Down
4 changes: 2 additions & 2 deletions src/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
17 changes: 9 additions & 8 deletions src/tools/store_collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,26 @@ 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.'),
category: z.string()
.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) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/actor-server-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading