Skip to main content
Glama

get_user_project_tasks

Retrieve all tasks associated with a specific project assigned to the current user by providing the project ID within the MoCo MCP Server.

Instructions

Get all tasks for a specific assigned project by project ID. Only works for projects assigned to the current user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID to retrieve tasks for

Implementation Reference

  • The handler function that implements the core logic of the get_user_project_tasks tool. It validates the projectId, fetches tasks using MocoApiService.getProjectTasks, handles empty results and errors, and formats the output.
    handler: async (params: z.infer<typeof GetProjectTasksSchema>): Promise<string> => { const { projectId } = params; if (!Number.isInteger(projectId) || projectId <= 0) { return createValidationErrorMessage({ field: 'projectId', value: projectId, reason: 'invalid_project_id' }); } try { const apiService = new MocoApiService(); const tasks = await apiService.getProjectTasks(projectId); if (tasks.length === 0) { return createEmptyResultMessage({ type: 'tasks', projectId }); } return formatProjectTasks(tasks, projectId); } catch (error) { return `Error retrieving tasks for project ${projectId}: ${error instanceof Error ? error.message : 'Unknown error'}`; } }
  • Zod schema defining the input parameters for the tool, specifically requiring a positive project ID.
    const GetProjectTasksSchema = z.object({ projectId: z.number().positive().describe('Project ID to retrieve tasks for') });
  • src/index.ts:34-42 (registration)
    The tool object is imported and added to the AVAILABLE_TOOLS array, which is used by the MCP server to list and dispatch tool calls.
    const AVAILABLE_TOOLS = [ getActivitiesTool, getUserProjectsTool, getUserProjectTasksTool, getUserHolidaysTool, getUserPresencesTool, getUserSickDaysTool, getPublicHolidaysTool ];
  • Helper function used by the handler to format the retrieved tasks into a human-readable string with task details.
    function formatProjectTasks(tasks: Task[], projectId: number): string { const lines: string[] = []; lines.push(`Tasks for project ${projectId} (${tasks.length} found):\n`); tasks.forEach(task => { lines.push(`ID: ${task.id}`); lines.push(`Name: ${task.name}`); lines.push(`Status: ${task.active ? 'Active' : 'Inactive'}`); lines.push(`Billable: ${task.billable ? 'Yes' : 'No'}`); lines.push(''); // Empty line between tasks }); return lines.join('\\n'); }

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/niondigital/moco-mcp'

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