get-task
Retrieve detailed information about a specific task or allocation using its task ID. Access task details including assignments and dates from your float.com projects.
Instructions
Get detailed information about a specific task/allocation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | The task ID (task_id) |
Implementation Reference
- The handler function for the 'get-task' tool. It defines the tool using createTool, validates the task_id input param, and calls floatApi.get('/tasks/{task_id}') to fetch a single task from the Float API, returning the parsed task via taskSchema.
export const getTask = createTool( 'get-task', 'Get detailed information about a specific task/allocation', z.object({ task_id: z.union([z.string(), z.number()]).describe('The task ID (task_id)'), }), async (params) => { const task = await floatApi.get(`/tasks/${params.task_id}`, taskSchema); return task; } ); - Input schema for the get-task tool: requires a task_id parameter (accepts string or number).
z.object({ task_id: z.union([z.string(), z.number()]).describe('The task ID (task_id)'), }), - src/types/float.ts:109-127 (schema)taskSchema: Zod schema that validates the task response from the Float API, including fields like task_id, project_id, people_id, name, dates, hours, priority, etc.
export const taskSchema = z.object({ task_id: z.number().optional(), // Float API uses task_id, not id project_id: z.number().optional(), people_id: z.number().optional(), name: z.string(), notes: z.string().nullable().optional(), status: z.number().optional(), // Float API uses numeric status codes start_date: z.string().nullable().optional(), end_date: z.string().nullable().optional(), estimated_hours: z.number().nullable().optional(), actual_hours: z.number().nullable().optional(), priority: z.number().nullable().optional(), created: z.string().nullable().optional(), // Float API uses 'created', not 'created_at' modified: z.string().nullable().optional(), // Float API uses 'modified', not 'updated_at' task_type: z.number().nullable().optional(), billable: z.number().nullable().optional(), // 0 = non-billable, 1 = billable repeat_state: z.number().nullable().optional(), repeat_end: z.string().nullable().optional(), }); - src/tools/index.ts:59-323 (registration)The getTask export from tasks.ts is imported and included in the legacyTools array, which is then exported as part of the 'tools' and 'allTools' arrays.
getTask, createTask, updateTask, deleteTask, } from './project-management/tasks.js'; import { listClients, getClient, createClient, updateClient, deleteClient, } from './project-management/clients.js'; import { listAllocations, getAllocation, createAllocation, updateAllocation, deleteAllocation, } from './project-management/allocations.js'; import { listMilestones, getMilestone, createMilestone, updateMilestone, deleteMilestone, getProjectMilestones, getUpcomingMilestones, getOverdueMilestones, completeMilestone, getMilestoneReminders, } from './project-management/milestones.js'; import { listPhases, getPhase, createPhase, updatePhase, deletePhase, listPhasesByProject, getPhasesByDateRange, getActivePhases, getPhaseSchedule, } from './project-management/phases.js'; import { listProjectTasks, getProjectTask, createProjectTask, updateProjectTask, deleteProjectTask, getProjectTasksByProject, getProjectTasksByPhase, bulkCreateProjectTasks, reorderProjectTasks, archiveProjectTask, getProjectTaskDependencies, } from './project-management/project-tasks.js'; // Time management tools import { listTimeOff, getTimeOff, createTimeOff, updateTimeOff, deleteTimeOff, bulkCreateTimeOff, approveTimeOff, rejectTimeOff, listTimeOffTypes, getTimeOffCalendar, getPersonTimeOffSummary, } from './time-management/timeoff.js'; import { listTimeOffTypes as listTimeOffTypesConfig, getTimeOffType, createTimeOffType, updateTimeOffType, deleteTimeOffType, } from './time-management/timeoff-types.js'; import { listPublicHolidays, getPublicHoliday, createPublicHoliday, updatePublicHoliday, deletePublicHoliday, } from './time-management/public-holidays.js'; import { listTeamHolidays, getTeamHoliday, createTeamHoliday, updateTeamHoliday, deleteTeamHoliday, listTeamHolidaysByDepartment, listTeamHolidaysByDateRange, listRecurringTeamHolidays, getUpcomingTeamHolidays, } from './time-management/team-holidays.js'; import { listLoggedTime, getLoggedTime, createLoggedTime, updateLoggedTime, deleteLoggedTime, bulkCreateLoggedTime, getPersonLoggedTimeSummary, getProjectLoggedTimeSummary, getLoggedTimeTimesheet, getBillableTimeReport, } from './time-management/logged-time.js'; // Reporting tools import { getTimeReport, getProjectReport, getPeopleUtilizationReport, } from './reporting/reports.js'; // Legacy tools export (preserved for backward compatibility) export const legacyTools = [ // Core entity tools listPeople, getPerson, createPerson, updatePerson, deletePerson, listDepartments, getDepartment, createDepartment, updateDepartment, deleteDepartment, listStatuses, getStatus, createStatus, updateStatus, deleteStatus, getDefaultStatus, setDefaultStatus, getStatusesByType, listRoles, getRole, createRole, updateRole, deleteRole, getRolesByPermission, getRolePermissions, updateRolePermissions, getRoleHierarchy, checkRoleAccess, listAccounts, getAccount, updateAccount, manageAccountPermissions, createAccount, deactivateAccount, reactivateAccount, getCurrentAccount, updateAccountTimezone, setAccountDepartmentFilter, bulkUpdateAccountPermissions, // Project management tools listProjects, getProject, createProject, updateProject, deleteProject, listTasks, getTask, createTask, updateTask, deleteTask, listClients, getClient, createClient, updateClient, deleteClient, listAllocations, getAllocation, createAllocation, updateAllocation, deleteAllocation, listMilestones, getMilestone, createMilestone, updateMilestone, deleteMilestone, getProjectMilestones, getUpcomingMilestones, getOverdueMilestones, completeMilestone, getMilestoneReminders, listPhases, getPhase, createPhase, updatePhase, deletePhase, listPhasesByProject, getPhasesByDateRange, getActivePhases, getPhaseSchedule, listProjectTasks, getProjectTask, createProjectTask, updateProjectTask, deleteProjectTask, getProjectTasksByProject, getProjectTasksByPhase, bulkCreateProjectTasks, reorderProjectTasks, archiveProjectTask, getProjectTaskDependencies, // Time management tools listTimeOff, getTimeOff, createTimeOff, updateTimeOff, deleteTimeOff, bulkCreateTimeOff, approveTimeOff, rejectTimeOff, listTimeOffTypes, getTimeOffCalendar, getPersonTimeOffSummary, listTimeOffTypesConfig, getTimeOffType, createTimeOffType, updateTimeOffType, deleteTimeOffType, listPublicHolidays, getPublicHoliday, createPublicHoliday, updatePublicHoliday, deletePublicHoliday, listTeamHolidays, getTeamHoliday, createTeamHoliday, updateTeamHoliday, deleteTeamHoliday, listTeamHolidaysByDepartment, listTeamHolidaysByDateRange, listRecurringTeamHolidays, getUpcomingTeamHolidays, listLoggedTime, getLoggedTime, createLoggedTime, updateLoggedTime, deleteLoggedTime, bulkCreateLoggedTime, getPersonLoggedTimeSummary, getProjectLoggedTimeSummary, getLoggedTimeTimesheet, getBillableTimeReport, // Reporting tools getTimeReport, getProjectReport, getPeopleUtilizationReport, ]; // Primary export: Optimized tools (4 consolidated tools replacing 246+ granular tools) // Also includes legacy tools for backward compatibility with existing tests export const tools = [...optimizedTools, ...legacyTools]; // Alternative export that includes both optimized and legacy tools export const allTools = [...optimizedTools, ...legacyTools]; - src/tools/base.ts:50-104 (helper)The createTool helper function that wraps all tool definitions - it takes name, description, schema, and an async handler, returns a tool object with inputSchema and a wrapped handler that handles validation, API errors, and response formatting.
export const createTool = <T, P extends z.ZodType>( name: string, description: string, schema: P, handler: (params: z.infer<P>) => Promise<T> ): { name: string; description: string; inputSchema: P; handler: (params: unknown) => Promise<ToolResponse<T>>; } => { return { name, description, inputSchema: schema, handler: async (params: unknown): Promise<ToolResponse<T>> => { try { const validatedParams = schema.parse(params); const result = await handler(validatedParams); // Extract format from params if available const responseFormat = ((validatedParams as Record<string, unknown>).format as ResponseFormat) || 'json'; return { success: true, data: result, format: responseFormat }; } catch (error) { logger.error(`Error in ${name} tool:`, error); // Handle Float API errors with enhanced formatting if (error instanceof FloatApiError) { return FloatErrorHandler.formatErrorForMcp(error) as ToolResponse<T>; } // Handle parameter validation errors if (error instanceof z.ZodError) { return { success: false, error: `Parameter validation failed: ${error.errors.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ')}`, errorCode: 'PARAMETER_VALIDATION_ERROR', details: { validationErrors: error.errors, }, } as ToolResponse<T>; } // Handle other errors return { success: false, error: error instanceof Error ? error.message : 'Unknown error occurred', errorCode: 'UNKNOWN_ERROR', } as ToolResponse<T>; } }, }; };