get_popular_animations
Retrieve a list of trending Lottie animations using paging options to specify page number and items per page, ideal for discovering popular content on LottieFiles.
Instructions
Get a list of currently popular Lottie animations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of items per page | |
| page | No | Page number, starting from 1 |
Implementation Reference
- src/handlers/ToolHandler.ts:124-143 (handler)The main handler logic for the 'get_popular_animations' tool. It calls the LottieApiClient to fetch popular animations and formats the response as MCP tool content.case "get_popular_animations": const popular = await this.apiClient.getPopularAnimations( args?.page as number, args?.limit as number ); return { content: [ { type: "text", text: JSON.stringify( { count: popular.length, popular: popular, }, null, 2 ), }, ], };
- src/handlers/ToolHandler.ts:57-79 (registration)Registration of the 'get_popular_animations' tool in the listTools method, including name, description, and input schema.{ name: "get_popular_animations", description: "Get a list of currently popular Lottie animations.", inputSchema: { type: "object", properties: { page: { type: "integer", description: "Page number, starting from 1", minimum: 1, default: 1, }, limit: { type: "integer", description: "Number of items per page", minimum: 1, maximum: 100, default: 20, }, }, }, }, ],
- src/api/LottieApiClient.ts:79-98 (helper)Helper method in LottieApiClient that performs the actual API call to fetch popular animations from LottieFiles.async getPopularAnimations(page: number = 1, limit: number = 20) { try { const response = await this.axiosInstance.get( `${this.baseUrl}/iconscout/popular-animations-weekly?api=%26sort%3Dpopular`, { params: { page, limit, }, } ); return response.data.popularWeeklyData.data; } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get popular animations: ${error.message}`); } throw new Error("Failed to get popular animations: Unknown error"); } }
- src/types.ts:22-25 (schema)TypeScript interface defining the input parameters for get_popular_animations.export interface GetPopularAnimationsParams { page?: number; limit?: number; }
- src/types.ts:34-39 (schema)TypeScript interface defining the output response for get_popular_animations.export interface GetPopularAnimationsResponse { animations: LottieAnimation[]; total: number; page: number; limit: number; }