Skip to main content
Glama

search_media

Search for movies, shows, episodes, artists, albums, or tracks within your Plex libraries using a specific query to quickly find desired media content.

Instructions

Search for media in Plex libraries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
typeNoMedia type (movie, show, episode, artist, album, track)

Implementation Reference

  • The main handler function that executes the search_media tool. It constructs search parameters, calls the Plex /search endpoint via makeRequest, extracts results, and returns formatted JSON response.
    private async searchMedia(query: string, type?: string) { const params: Record<string, any> = { query }; if (type) { params.type = this.getPlexTypeId(type); } const data = await this.makeRequest("/search", params); const results = data.MediaContainer?.Metadata || []; return { content: [ { type: "text", text: JSON.stringify({ results: results.map((item: any) => ({ ratingKey: item.ratingKey, title: item.title, type: item.type, year: item.year, summary: item.summary, rating: item.rating, thumb: item.thumb, })), }, null, 2), }, ], }; }
  • The input schema definition for the search_media tool, including parameters query (required string) and optional type enum.
    name: "search_media", description: "Search for media in Plex libraries", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query", }, type: { type: "string", description: "Media type (movie, show, episode, artist, album, track)", enum: ["movie", "show", "episode", "artist", "album", "track"], }, }, required: ["query"], }, },
  • src/index.ts:267-271 (registration)
    The switch case in the CallToolRequestSchema handler that registers and dispatches calls to the searchMedia handler function.
    case "search_media": return await this.searchMedia( (args as any)?.query as string, (args as any)?.type as string );

Other Tools

Related Tools

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