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
      );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Search') but lacks critical details: it doesn't mention whether results are paginated, what the output format looks like, if there are rate limits, or any authentication requirements. For a search tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse. Every word earns its place, achieving optimal conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search operation, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like result format, pagination, or error handling. While the schema covers parameters well, the overall context for effective tool use is lacking, especially for a tool that likely returns varied results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('query' and 'type') fully. The description adds no additional meaning beyond what's in the schema—it doesn't explain query syntax, default behaviors, or how 'type' filtering works. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Search') and resource ('media in Plex libraries'), making the purpose immediately understandable. It distinguishes itself from siblings like 'get_media_details' (which retrieves specific items) or 'get_recently_added' (which lists recent content). However, it doesn't specify the scope (e.g., across all libraries or specific ones), which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when search is appropriate over browsing methods (like 'get_popular_content' or 'get_recently_added'), nor does it specify prerequisites or exclusions. This leaves the agent without context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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