An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.
JavaScript aicursorcursor-aicursorailovablelovable-devroocodetask-managertaskstasks-listwindsurfwindsurf-ai
fix(mcp): optimize get_task response payload by removing allTasks data
Eyal Toledano74b67830ac7b
diff --git a/.changeset/two-bats-smoke.md b/.changeset/two-bats-smoke.mdindex 79ce7ab2..cbd79be6 100644--- a/.changeset/two-bats-smoke.md+++ b/.changeset/two-bats-smoke.md@@ -8,6 +8,11 @@- Rename `list-tasks` to `get-tasks` for more intuitive client requests like "get my tasks"- Rename `show-task` to `get-task` for consistency with GET-based API naming conventions+- **Optimize MCP response payloads:**+ - Add custom `processTaskResponse` function to `get-task` MCP tool to filter out unnecessary `allTasks` array data+ - Significantly reduce response size by returning only the specific requested task instead of all tasks+ - Preserve dependency status relationships for the UI/CLI while keeping MCP responses lean and efficient+- **Refactor project root handling for MCP Server:**- **Prioritize Session Roots**: MCP tools now extract the project root path directly from `session.roots[0].uri` provided by the client (e.g., Cursor).- **New Utility `getProjectRootFromSession`**: Added to `mcp-server/src/tools/utils.js` to encapsulate session root extraction and decoding. **Further refined for more reliable detection, especially in integrated environments, including deriving root from script path and avoiding fallback to '/'.**diff --git a/mcp-server/src/tools/get-task.js b/mcp-server/src/tools/get-task.jsindex b007be4b..17289059 100644--- a/mcp-server/src/tools/get-task.js+++ b/mcp-server/src/tools/get-task.js@@ -11,6 +11,24 @@ import {} from "./utils.js";import { showTaskDirect } from "../core/task-master-core.js";+/**+ * Custom processor function that removes allTasks from the response+ * @param {Object} data - The data returned from showTaskDirect+ * @returns {Object} - The processed data with allTasks removed+ */+function processTaskResponse(data) {+ if (!data) return data;++ // If we have the expected structure with task and allTasks+ if (data.task) {+ // Return only the task object, removing the allTasks array+ return data.task;+ }++ // If structure is unexpected, return as is+ return data;+}+/*** Register the get-task tool with the MCP server* @param {Object} server - FastMCP server instance@@ -63,7 +81,8 @@ export function registerShowTaskTool(server) {log.error(`Failed to get task: ${result.error.message}`);}- return handleApiResult(result, log, 'Error retrieving task details');+ // Use our custom processor function to remove allTasks from the response+ return handleApiResult(result, log, 'Error retrieving task details', processTaskResponse);} catch (error) {log.error(`Error in get-task tool: ${error.message}\n${error.stack}`); // Add stack tracereturn createErrorResponse(`Failed to get task: ${error.message}`);