Skip to main content
Glama

update_timeslip

Modify an existing timeslip entry to update hours worked, project details, dates, or comments for accurate time tracking in FreeAgent.

Instructions

Update an existing timeslip

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesTimeslip ID
taskNoTask URL
userNoUser URL
projectNoProject URL
dated_onNoDate (YYYY-MM-DD)
hoursNoHours worked (e.g. "1.5")
commentNoOptional comment

Implementation Reference

  • Main handler logic for the 'update_timeslip' tool: parses arguments, filters valid update fields, invokes the client method, and formats the response.
    case 'update_timeslip': { const { id, ...updates } = request.params.arguments as { id: string } & Record<string, unknown>; // Only include valid update fields const validUpdates: Partial<TimeslipAttributes> = {}; if (typeof updates.task === 'string') validUpdates.task = updates.task; if (typeof updates.user === 'string') validUpdates.user = updates.user; if (typeof updates.project === 'string') validUpdates.project = updates.project; if (typeof updates.dated_on === 'string') validUpdates.dated_on = updates.dated_on; if (typeof updates.hours === 'string') validUpdates.hours = updates.hours; if (typeof updates.comment === 'string') validUpdates.comment = updates.comment; const timeslip = await this.client.updateTimeslip(id, validUpdates); return { content: [{ type: 'text', text: JSON.stringify(timeslip, null, 2) }] }; }
  • src/index.ts:133-149 (registration)
    Registration of the 'update_timeslip' tool in the ListTools response, defining name, description, and JSON input schema.
    { name: 'update_timeslip', description: 'Update an existing timeslip', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Timeslip ID' }, 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: ['id'] } },
  • FreeAgentClient helper method that executes the HTTP PUT request to the FreeAgent API to update a timeslip.
    async updateTimeslip(id: string, timeslip: Partial<TimeslipAttributes>): Promise<Timeslip> { try { console.error('[API] Updating timeslip:', id, timeslip); const response = await this.axiosInstance.put<TimeslipResponse>(`/timeslips/${id}`, { timeslip }); return response.data.timeslip; } catch (error) { console.error('[API] Failed to update timeslip:', error); throw error; } }
  • TypeScript interface defining the structure of TimeslipAttributes used in update operations (Partial used in client method).
    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; }

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