get_goals
Retrieve active goals including step, activity, and weight goals, along with their current progress.
Instructions
Get active goals: step goals, activity goals, weight goals, and their progress
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/profile.tools.ts:133-144 (registration)Registration of the 'get_goals' tool with the MCP server, including description and handler that calls client.getGoals().
server.registerTool( 'get_goals', { description: 'Get active goals: step goals, activity goals, weight goals, and their progress', }, async () => { const data = await client.getGoals(); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/client/garmin.client.ts:491-510 (handler)Handler implementation of getGoals() which fetches goals from the Garmin API with pagination, using the GOALS_ENDPOINT and DEFAULT_GOALS_STATUS/DEFAULT_GOALS_LIMIT constants.
async getGoals(status = DEFAULT_GOALS_STATUS): Promise<unknown> { const allGoals: unknown[] = []; let start = 0; while (true) { const page = await this.request<unknown[]>( `${GOALS_ENDPOINT}?status=${status}&start=${start}&limit=${DEFAULT_GOALS_LIMIT}&sortOrder=asc`, ); if (!Array.isArray(page) || page.length === 0) break; allGoals.push(...page); if (page.length < DEFAULT_GOALS_LIMIT) break; start += DEFAULT_GOALS_LIMIT; } return allGoals; } - Endpoint constant GOALS_ENDPOINT = '/goal-service/goal/goals' used by the handler.
export const GOALS_ENDPOINT = '/goal-service/goal/goals'; - Default status filter constant DEFAULT_GOALS_STATUS = 'active' used by the handler.
export const DEFAULT_GOALS_STATUS = 'active'; - Pagination limit constant DEFAULT_GOALS_LIMIT = 100 used by the handler.
export const DEFAULT_GOALS_LIMIT = 100;