search_tasks
Find tasks by searching titles or descriptions to locate specific items in your task management system.
Instructions
Search tasks by title or description
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_tasks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query |
Implementation Reference
- src/tools.ts:273-313 (handler)The core handler function for the 'search_tasks' tool. It validates input using SearchSchema, loads all tasks, filters those matching the query in title or description (case-insensitive), and returns formatted results or a 'no matches' message.
export async function searchTasks(args: unknown) { // Validate input const validated = SearchSchema.parse(args); // Load tasks const storage = await loadTasks(); const query = validated.query.toLowerCase(); // Search in title and description const matchingTasks = storage.tasks.filter( (t) => t.title.toLowerCase().includes(query) || (t.description && t.description.toLowerCase().includes(query)) ); if (matchingTasks.length === 0) { return { content: [ { type: "text", text: `No tasks found matching "${validated.query}".`, }, ], }; } // Format results let result = `🔍 Found ${matchingTasks.length} task(s) matching "${validated.query}":\n\n`; matchingTasks.forEach((task) => { result += formatTask(task) + "\n"; }); return { content: [ { type: "text", text: result, }, ], }; } - src/index.ts:156-170 (registration)Tool registration in the TOOLS array, including name, description, and inputSchema for MCP tool listing.
{ name: "search_tasks", description: "Search tasks by title or description", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query", minLength: 1, }, }, required: ["query"], }, }, - src/index.ts:230-231 (registration)Dispatch in the switch statement for handling 'search_tasks' tool calls, invoking the searchTasks handler.
case "search_tasks": return await searchTasks(args); - src/types.ts:65-67 (schema)Internal Zod schema used by the handler for input validation.
export const SearchSchema = z.object({ query: z.string().min(1, "Search query is required"), });