search-tasks
Find tasks in Todo.txt files by searching for specific text or keywords to locate relevant items quickly.
Instructions
Search for tasks containing a query string.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- src/tools.ts:154-162 (handler)The handler function for the 'search-tasks' tool. It loads all tasks, filters those whose string representation includes the provided query, and returns the matching tasks joined by newlines in a text content block.async ({ query }) => { const tasks = await loadTasks(); const matchingTasks = tasks.filter(task => task.toString().includes(query)); return { content: [ { type: "text", text: matchingTasks.map(task => task.toString()).join("\n") }, ], }; }
- src/tools.ts:153-153 (schema)The input schema for the 'search-tasks' tool, defining a required 'query' parameter as a Zod string schema.{ query: z.string() },
- src/tools.ts:150-163 (registration)The registration of the 'search-tasks' tool on the MCP server using server.tool(), including the tool name, description, input schema, and handler function.server.tool( "search-tasks", "Search for tasks containing a query string.", { query: z.string() }, async ({ query }) => { const tasks = await loadTasks(); const matchingTasks = tasks.filter(task => task.toString().includes(query)); return { content: [ { type: "text", text: matchingTasks.map(task => task.toString()).join("\n") }, ], }; } );