get_all_badges
Retrieve all available badges for your organization to view badge IDs and names for management and selection purposes.
Instructions
Retrieve all available badges for the authenticated organization. Returns a list of badges with their IDs and names.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of badges to return (default: 100, max: 100) |
Implementation Reference
- src/index.ts:428-455 (handler)MCP tool handler: validates input with GetAllBadgesSchema, calls apiClient.getAllBadges, formats and returns the list of badges or error response.case 'get_all_badges': { const validatedArgs = GetAllBadgesSchema.parse(args); const result = await apiClient.getAllBadges(validatedArgs.limit); if (result.success && result.data) { const badgeList = result.data.map((badge: Badge, index: number) => `${index + 1}. ${badge.name} (ID: ${badge.id})` ).join('\n'); return { content: [ { type: 'text', text: `🏆 Available Badges (${result.data.length}):\n\n${badgeList}\n\n${JSON.stringify(result, null, 2)}`, }, ], }; } return { content: [ { type: 'text', text: `📋 Badge List Result:\n\n${JSON.stringify(result, null, 2)}`, }, ], }; }
- src/index.ts:69-71 (schema)Zod schema defining the optional 'limit' parameter for the get_all_badges tool input validation.const GetAllBadgesSchema = z.object({ limit: z.number().optional().describe('Maximum number of badges to return (default: 100)'), });
- src/index.ts:260-276 (registration)Tool registration in the MCP tools array, defining name, description, and JSON inputSchema.{ name: 'get_all_badges', description: 'Retrieve all available badges for the authenticated organization. Returns a list of badges with their IDs and names.', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum number of badges to return (default: 100, max: 100)', default: 100, minimum: 1, maximum: 100, }, }, required: [], }, },
- src/index.ts:179-184 (helper)API client helper method that performs the HTTP GET request to '/badge/getall' to fetch badges.async getAllBadges(limit = 100): Promise<ApiResponse<Badge[]>> { const response = await this.client.get('/badge/getall', { params: { limit }, }); return response.data; }