Skip to main content
Glama

list_tasks

Filter and organize tasks by status or priority to streamline task management and improve productivity. Designed for efficient task tracking and prioritization within structured workflows.

Instructions

List tasks with optional filtering by status and priority.

Input Schema

NameRequiredDescriptionDefault
priorityNoFilter tasks by priority level
statusNoFilter tasks by status

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "priority": { "description": "Filter tasks by priority level", "enum": [ "low", "medium", "high" ], "type": "string" }, "status": { "description": "Filter tasks by status", "enum": [ "todo", "in-progress", "blocked", "done" ], "type": "string" } }, "type": "object" }

Implementation Reference

  • The execute function for the 'list_tasks' tool. Validates parameters using ListTasksSchema, retrieves all tasks from taskStorage, applies optional filters by status and priority, and returns the filtered list with count.
    execute: async (params: any) => { try { // Validate input parameters const validatedParams = ListTasksSchema.parse(params); const allTasks = taskStorage.getAll(); const filter: Partial<Task> = {}; if (validatedParams.status) filter.status = validatedParams.status; if (validatedParams.priority) filter.priority = validatedParams.priority; // Apply filters if any const filteredTasks = Object.keys(filter).length > 0 ? allTasks.filter(task => { return Object.entries(filter).every(([key, value]) => task[key as keyof Task] === value ); }) : allTasks; return JSON.stringify({ tasks: filteredTasks, count: filteredTasks.length, filters: Object.keys(filter).length > 0 ? filter : "none" }); } catch (error) { return JSON.stringify({ error: `Invalid list parameters: ${error instanceof Error ? error.message : String(error)}` }); } }
  • Zod schema defining optional parameters for list_tasks: status (TaskStatusEnum) and priority (TaskPriorityEnum).
    // Schema for list_tasks parameters const ListTasksSchema = z.object({ status: TaskStatusEnum.optional(), priority: TaskPriorityEnum.optional() });
  • Registration of the 'list_tasks' tool on the FastMCP server instance, specifying name, description, and execute handler.
    server.addTool({ name: "list_tasks", description: "List tasks with optional filtering by status and priority.", execute: async (params: any) => { try { // Validate input parameters const validatedParams = ListTasksSchema.parse(params); const allTasks = taskStorage.getAll(); const filter: Partial<Task> = {}; if (validatedParams.status) filter.status = validatedParams.status; if (validatedParams.priority) filter.priority = validatedParams.priority; // Apply filters if any const filteredTasks = Object.keys(filter).length > 0 ? allTasks.filter(task => { return Object.entries(filter).every(([key, value]) => task[key as keyof Task] === value ); }) : allTasks; return JSON.stringify({ tasks: filteredTasks, count: filteredTasks.length, filters: Object.keys(filter).length > 0 ? filter : "none" }); } catch (error) { return JSON.stringify({ error: `Invalid list parameters: ${error instanceof Error ? error.message : String(error)}` }); } } });

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/flight505/mcp-think-tank'

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