search
Find users and tasks in the MCP Test Server by entering search queries to locate specific data entries.
Instructions
Search users and tasks
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query |
Implementation Reference
- src/domains/search.js:5-25 (handler)Implements the core logic of the 'search' tool by querying both UserService and TaskService and aggregating results.
static search(query) { if (!query) { return { success: false, message: 'Query parameter is required' }; } const userResults = UserService.search(query); const taskResults = TaskService.search(query); return { success: true, query, results: { users: userResults, tasks: taskResults }, totalResults: userResults.length + taskResults.length }; } - src/domains/search.js:29-42 (schema)Defines the input schema, name, and description for the MCP 'search' tool.
export const searchToolSchema = { name: 'search', description: 'Search users and tasks', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query' } }, required: ['query'] } }; - mcp-server.js:38-46 (registration)Registers the 'search' tool for listing by including its schema in the tools response.
this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ ...userToolSchemas, ...taskToolSchemas, searchToolSchema ] }; }); - mcp-server.js:64-65 (registration)Dispatches calls to the 'search' tool by invoking SearchService.search in the callToolRequestSchema handler.
case 'search': return createMcpResponse(SearchService.search(args.query));