lokalise_get_task
Retrieve detailed information about a specific translation task, including progress, assignments, and history, to check status or debug workflow issues.
Instructions
Investigates a specific work assignment in detail. Required: projectId, taskId. Use to check task progress, view assignee workload, or debug workflow issues. Returns: Complete task data including all assignments, completion percentages, settings, and history. Pairs with: lokalise_update_task for modifications.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID containing the task | |
| taskId | Yes | Task ID to get details for |
Implementation Reference
- src/domains/tasks/tasks.tool.ts:107-133 (handler)MCP tool handler for 'lokalise_get_task'. Receives projectId and taskId arguments, calls tasksController.getTask, and formats the response for MCP.
async function handleGetTask(args: GetTaskToolArgsType) { const methodLogger = Logger.forContext( "tools/tasks.tool.ts", "handleGetTask", ); methodLogger.debug( `Getting task ${args.taskId} from project ${args.projectId}...`, args, ); try { const result = await tasksController.getTask(args); methodLogger.debug("Got the response from the controller", result); return { content: [ { type: "text" as const, text: result.content, }, ], }; } catch (error) { methodLogger.error("Error in handleGetTask", { error, args }); return formatErrorForMcpTool(error); } } - Zod schema defining input arguments for getTask: projectId (string) and taskId (number). Exports the inferred TypeScript type GetTaskToolArgsType.
export const GetTaskToolArgs = z .object({ projectId: z.string().describe("Project ID containing the task"), taskId: z.number().describe("Task ID to get details for"), }) .strict(); export type GetTaskToolArgsType = z.infer<typeof GetTaskToolArgs>; - src/domains/tasks/tasks.tool.ts:230-236 (registration)Registration of the 'lokalise_get_task' tool on the MCP server with name, description, schema shape, and handler function.
// Get Task Tool server.tool( "lokalise_get_task", "Investigates a specific work assignment in detail. Required: projectId, taskId. Use to check task progress, view assignee workload, or debug workflow issues. Returns: Complete task data including all assignments, completion percentages, settings, and history. Pairs with: lokalise_update_task for modifications.", GetTaskToolArgs.shape, handleGetTask, ); - Controller logic for getTask. Maps tool args to service parameters (GetTaskParams), calls tasksService.getTask, and formats the result using formatTaskDetails.
async function getTask(args: GetTaskToolArgsType): Promise<ControllerResponse> { const methodLogger = Logger.forContext( "controllers/tasks.controller.ts", "getTask", ); try { methodLogger.debug("Starting getTask operation", { projectId: args.projectId, taskId: args.taskId, }); // Map arguments to service parameters const serviceParams: tasksService.GetTaskParams = { project_id: args.projectId, task_id: args.taskId, }; const result = await tasksService.getTask(serviceParams); methodLogger.debug("Task retrieval successful", { projectId: args.projectId, taskId: args.taskId, title: result.title, }); const formatted = formatTaskDetails(result, args.projectId); return { content: formatted }; } catch (error) { throw handleControllerError( error, buildErrorContext( "Lokalise Task", "getTask", "controllers/tasks.controller.ts@getTask", `${args.projectId}:${args.taskId}`, { args }, ), ); } } - Service layer that calls the Lokalise Tasks API via the SDK (api.tasks().get()) to fetch a single task by project_id and task_id. Includes error handling for 404, 403, 401.
throw createApiError( "Tasks with languages require either 'users' or 'groups' to be specified for each language, or use the 'assignees' parameter to assign users to all languages", 400, ); } return lang; }); } const result = await api .tasks() .create(apiParams, { project_id: options.project_id }); methodLogger.debug("Lokalise Tasks API call successful - create", { projectId: options.project_id, taskId: result.task_id, title: result.title, }); return result; } catch (error: unknown) { methodLogger.error("Lokalise Tasks API call failed - create", { error: (error as Error).message, projectId: options.project_id, }); if ((error as ApiError).code === 404) { throw createApiError(`Project not found: ${options.project_id}`, 404); } if ((error as ApiError).code === 403) { throw createApiError("Access denied to this project", 403); } if ((error as ApiError).code === 401) { throw createApiError("Invalid API key", 401); } throw createUnexpectedError( `Failed to create task in project ${options.project_id}: ${(error as Error).message}`, ); } } /**