get_recently_added
Retrieve the most recently added media items from your Plex library using a numerical limit to control the number of results returned.
Instructions
Get recently added media
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of items to return (default: 10) |
Implementation Reference
- src/index.ts:545-569 (handler)The primary handler function that fetches recently added media from the Plex /library/recentlyAdded API endpoint, extracts metadata, and returns a formatted JSON response containing ratingKey, title, type, year, addedAt, and summary for each item.private async getRecentlyAdded(limit: number) { const data = await this.makeRequest("/library/recentlyAdded", { "X-Plex-Container-Start": 0, "X-Plex-Container-Size": limit, }); const items = data.MediaContainer?.Metadata || []; return { content: [ { type: "text", text: JSON.stringify({ recentlyAdded: items.map((item: any) => ({ ratingKey: item.ratingKey, title: item.title, type: item.type, year: item.year, addedAt: item.addedAt, summary: item.summary, })), }, null, 2), }, ], }; }
- src/index.ts:75-86 (schema)Input schema definition for the tool, specifying an optional 'limit' parameter of type number with default value 10.name: "get_recently_added", description: "Get recently added media", inputSchema: { type: "object", properties: { limit: { type: "number", description: "Number of items to return (default: 10)", default: 10, }, }, },
- src/index.ts:272-273 (registration)Registration and dispatching logic in the CallToolRequestSchema handler's switch statement, which extracts the limit argument and calls the getRecentlyAdded handler method.case "get_recently_added": return await this.getRecentlyAdded(((args as any)?.limit as number) || 10);
- src/index.ts:74-87 (registration)Tool registration entry in the ListToolsRequestSchema response, defining the tool name, description, and input schema for discovery.{ name: "get_recently_added", description: "Get recently added media", inputSchema: { type: "object", properties: { limit: { type: "number", description: "Number of items to return (default: 10)", default: 10, }, }, }, },