Skip to main content
Glama

tasks_search

Filter and retrieve tasks by status, text, or ID from MCP Tasks server. Use to search for tasks in progress, to-do, backlog, or other statuses with optional term matching and task ID lookup.

Instructions

Search tasks from specific statuses with optional text & ID filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsNoOptional list of task IDs to search for
limitNoMaximum number of results (only for really large task lists)
source_idNoSource ID from task_setup() response - Defaults to most recent in the workspace if not provided - Try to always provide it! - If you don't have it, ask the user for a file path and call task_setup()
statusesNoSpecific statuses to get. Gets all if omitted
termsNoSearch terms to filter tasks by text or status (case-insensitive, OR logic, no regex or wildcards)

Implementation Reference

  • Handler function for the 'search' tool, which is registered as 'tasks_search' when PREFIX_TOOLS is enabled. Filters tasks by statuses (default all), IDs, search terms (fuzzy match on text+status, OR logic), and optional limit. Returns array of matching tasks with id, text, status.
    handler: (args) => { const meta = metadata.load(args.source_id) const groups = args.statuses?.length ? args.statuses : meta.statuses let results = groups.flatMap(status => meta.groups[status] || []) if (args.ids) { results = results.filter(task => args.ids!.includes(task.id)) } if (args.terms?.length) { results = results.filter(task => args.terms!.some(term => util.fuzzySearch(`${task.text} ${task.status}`, term), )) } if (args.limit) { results = results.slice(0, args.limit) } return results
  • Zod input schema for the tasks_search tool defining parameters: source_id (required), statuses (optional array), terms (optional string array for fuzzy search), ids (optional task ID array), limit (optional max results).
    schema: z.object({ source_id: schemas.sourceId, statuses: z.array(schemas.status).optional().describe('Specific statuses to get. Gets all if omitted'), terms: z.array(z.string()).optional().describe('Search terms to filter tasks by text or status (case-insensitive, OR logic, no regex or wildcards)'), ids: schemas.ids.optional().describe('Optional list of task IDs to search for'), limit: z.number().int().min(1).optional().describe('Maximum number of results (only for really large task lists)'),
  • src/server.ts:16-41 (registration)
    MCP server registration loop that iterates over all tools from src/tools.ts and registers enabled non-resource tools using server.addTool(), including 'tasks_search' with its schema, description, name (prefixed), and execute handler that delegates to cli.runTool.
    for (const tool of Object.values(tools)) { if (!tool.isEnabled) { continue } if (tool.isResource) { // Register as resource server.addResource({ uri: `resource://${tool.name}`, name: tool.description, mimeType: 'text/plain', load: () => cli.runTool(tool, []).then(text => ({ text })), }) } else { // Register as tool with enhanced logging server.addTool({ annotations: { openWorldHint: false, // This tool doesn't interact with external systems readOnlyHint: tool.isReadOnly, title: tool.name, }, name: tool.name, description: tool.description, parameters: tool.schema, execute: (args) => cli.runTool(tool, args), }) }
  • defineTool factory function used to define all tools, including the 'search' tool as 'tasks_search' by prefixing the name if env.PREFIX_TOOLS is true. Sets other defaults like isReadOnly.
    function defineTool<S extends ZodSchema>(name: string, tool: { schema: S description: string isResource?: boolean isReadOnly?: boolean isEnabled?: boolean handler: (args: z.infer<S>, context?: any) => any fromArgs: (args: string[]) => z.infer<S> }) { const toolName = env.PREFIX_TOOLS ? `tasks_${name}` : name return { ...tool, name: toolName, isResource: tool.isResource ?? false, isReadOnly: tool.isReadOnly ?? false, isEnabled: tool.isEnabled ?? true, } }
  • Reusable Zod schema for source_id parameter used across tools including tasks_search.
    sourceId: z.string().min(1).optional().describe(util.trimLines(` Source ID from task_setup() response - Defaults to most recent in the workspace if not provided - Try to always provide it! - If you don't have it, ask the user for a file path and call task_setup() `)),

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/flesler/mcp-tasks'

If you have feedback or need assistance with the MCP directory API, please join our Discord server