Skip to main content
Glama

get_user_stats

Retrieve user-specific watch statistics from Plex Media Server, analyzing viewing habits within a specified time range for insights.

Instructions

Get user-specific watch statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeRangeNoTime range in days (default: 30)

Implementation Reference

  • The core handler function for the 'get_user_stats' tool. Fetches Plex user accounts from the '/accounts' API endpoint and returns a list with id, name, email, and thumbnail for each user. Includes error handling. Note: The timeRange parameter is not utilized in the current implementation.
    private async getUserStats(timeRange: number) {
      try {
        const data = await this.makeRequest("/accounts");
        const users = data.MediaContainer?.Account || [];
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                users: users.map((user: any) => ({
                  id: user.id,
                  name: user.name,
                  email: user.email,
                  thumb: user.thumb,
                })),
                totalUsers: users.length,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                message: "User statistics not available",
                error: "Unable to access user data",
              }, null, 2),
            },
          ],
        };
      }
    }
  • src/index.ts:174-187 (registration)
    Tool registration entry in the ListTools handler. Defines the tool name, description, and input schema for MCP protocol compliance.
    {
      name: "get_user_stats",
      description: "Get user-specific watch statistics",
      inputSchema: {
        type: "object",
        properties: {
          timeRange: {
            type: "number",
            description: "Time range in days (default: 30)",
            default: 30,
          },
        },
      },
    },
  • Input schema definition specifying the optional 'timeRange' parameter (number, default 30 days).
    inputSchema: {
      type: "object",
      properties: {
        timeRange: {
          type: "number",
          description: "Time range in days (default: 30)",
          default: 30,
        },
      },
    },
  • Dispatcher case in the main CallToolRequestSchema handler that routes calls to the specific getUserStats method, extracting and defaulting the timeRange argument.
    case "get_user_stats":
      return await this.getUserStats(((args as any)?.timeRange as number) || 30);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states what the tool does ('Get user-specific watch statistics') without explaining what 'watch statistics' includes, how data is retrieved (e.g., real-time vs. cached), permissions required, or response format. This leaves significant gaps in understanding the tool's behavior.

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 wasted words. It is appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration, making it easy for an agent to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'watch statistics' entails (e.g., metrics like watch time, counts), how results are structured, or any limitations (e.g., data freshness). For a tool with no structured behavioral data, this minimal description fails to provide sufficient context for effective use.

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?

The input schema has 100% description coverage, with the parameter 'timeRange' fully documented in the schema. The description adds no additional meaning beyond what the schema provides, such as clarifying the context of 'user-specific' or how the time range affects the statistics. With high schema coverage, the baseline score of 3 is appropriate.

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

Purpose3/5

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

The description 'Get user-specific watch statistics' clearly states the verb ('Get') and resource ('user-specific watch statistics'), providing a basic understanding of the tool's function. However, it doesn't differentiate this tool from sibling tools like 'get_watch_stats' or 'get_recently_watched', leaving ambiguity about what specific statistics or scope distinguishes it.

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. With multiple sibling tools related to watch data (e.g., get_watch_stats, get_recently_watched, get_watch_history), there is no indication of context, prerequisites, or exclusions to help an agent choose appropriately.

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