Skip to main content
Glama

create_timeslip

Log work hours in FreeAgent by creating timeslips with task, project, user, date, and duration details to track time accurately.

Instructions

Create a new timeslip

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYesTask URL
userYesUser URL
projectYesProject URL
dated_onYesDate (YYYY-MM-DD)
hoursYesHours worked (e.g. "1.5")
commentNoOptional comment

Implementation Reference

  • MCP tool handler for 'create_timeslip': validates input attributes and delegates to FreeAgentClient.createTimeslip, returning the created timeslip as JSON.
    case 'create_timeslip': { const attributes = validateTimeslipAttributes(request.params.arguments); const timeslip = await this.client.createTimeslip(attributes); return { content: [{ type: 'text', text: JSON.stringify(timeslip, null, 2) }] }; }
  • src/index.ts:117-132 (registration)
    Registers the 'create_timeslip' tool in the MCP server's list_tools response, including name, description, and JSON input schema.
    { name: 'create_timeslip', description: 'Create a new timeslip', inputSchema: { type: 'object', properties: { task: { type: 'string', description: 'Task URL' }, user: { type: 'string', description: 'User URL' }, project: { type: 'string', description: 'Project URL' }, dated_on: { type: 'string', description: 'Date (YYYY-MM-DD)' }, hours: { type: 'string', description: 'Hours worked (e.g. "1.5")' }, comment: { type: 'string', description: 'Optional comment' } }, required: ['task', 'user', 'project', 'dated_on', 'hours'] } },
  • Input validation function for create_timeslip parameters, ensuring required fields are present and casting to TimeslipAttributes type.
    function validateTimeslipAttributes(data: unknown): TimeslipAttributes { if (typeof data !== 'object' || !data) { throw new Error('Invalid timeslip data: must be an object'); } const attrs = data as Record<string, unknown>; if (typeof attrs.task !== 'string' || typeof attrs.user !== 'string' || typeof attrs.project !== 'string' || typeof attrs.dated_on !== 'string' || typeof attrs.hours !== 'string') { throw new Error('Invalid timeslip data: missing required fields'); } return { task: attrs.task, user: attrs.user, project: attrs.project, dated_on: attrs.dated_on, hours: attrs.hours, comment: attrs.comment as string | undefined }; }
  • TypeScript interface defining the structure of TimeslipAttributes used for create_timeslip input.
    export interface TimeslipAttributes { url?: string; task: string; user: string; project: string; dated_on: string; hours: string; comment?: string; billed_on_invoice?: string; created_at?: string; updated_at?: string; timer?: TimerAttributes; }
  • FreeAgentClient method that performs the actual API POST request to create a timeslip in FreeAgent.
    async createTimeslip(timeslip: TimeslipAttributes): Promise<Timeslip> { try { console.error('[API] Creating timeslip:', timeslip); const response = await this.axiosInstance.post<TimeslipResponse>('/timeslips', { timeslip }); return response.data.timeslip; } catch (error) { console.error('[API] Failed to create timeslip:', error); throw error; } }

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/markpitt/freeagent-mcp'

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