Skip to main content
Glama

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
NameRequiredDescriptionDefault
limitNoNumber of items to return (default: 10)

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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,
          },
        },
      },
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/niavasha/plex-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server