set_activity_name
Rename a Garmin activity by specifying its activity ID and a new name.
Instructions
Rename an activity
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activityId | Yes | The Garmin activity ID | |
| name | Yes | New name for the activity |
Implementation Reference
- src/tools/write.tools.ts:20-25 (handler)The actual tool handler logic that calls client.setActivityName and formats the JSON response.
async ({ activityId, name }) => { const data = await client.setActivityName(activityId, name); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, - src/client/garmin.client.ts:668-673 (handler)The GarminClient method that makes the HTTP PUT request to the Garmin Connect API to rename an activity.
async setActivityName(activityId: number, name: string): Promise<unknown> { return this.request(`${ACTIVITY_ENDPOINT}/${activityId}`, { method: 'PUT', body: { activityName: name }, }); } - src/tools/write.tools.ts:14-26 (registration)Registration of the 'set_activity_name' tool via server.registerTool with description and input schema.
server.registerTool( 'set_activity_name', { description: 'Rename an activity', inputSchema: setActivityNameSchema.shape, }, async ({ activityId, name }) => { const data = await client.setActivityName(activityId, name); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/dtos/write.dto.ts:9-11 (schema)Zod schema defining the input validation for set_activity_name: activityId (positive number) and name (string).
export const setActivityNameSchema = z.object({ activityId: z.number().positive().describe('The Garmin activity ID'), name: z.string().describe('New name for the activity'), - src/dtos/write.dto.ts:4-7 (schema)TypeScript type definition for the setActivityName DTO.
export type SetActivityNameDto = { activityId: number; name: string; };