get-badges
Access all earned badges and achievements from your Garmin Connect account.
Instructions
Get all earned badges/achievements
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:656-665 (registration)Registration of the 'get-badges' tool via server.tool() - defines name, description, schema (empty), and handler
server.tool( "get-badges", "Get all earned badges/achievements", {}, async () => { const client = getClient(); const data = await client.get("badge-service/badge/earned"); return jsonResult(data); } ); - src/tools.ts:660-664 (handler)Handler function for 'get-badges': calls badge-service/badge/earned endpoint and returns JSON result
async () => { const client = getClient(); const data = await client.get("badge-service/badge/earned"); return jsonResult(data); } - src/tools.ts:14-18 (helper)jsonResult helper used to format the API response as text content
function jsonResult(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], }; } - src/tools.ts:7-11 (helper)Imports getSharedClient (as getClient) from garmin-client, used to make the API call
getSharedClient, resetSharedClient, sessionExists, getSessionFile, } from "./garmin-client.js"; - src/test.ts:467-473 (registration)Test for 'get-badges' tool calling it and checking for errors
{ name: "get-badges", run: async (server) => { const result = await callTool(server, "get-badges"); if (result.isError) throw new Error(getToolText(result)); }, },