Skip to main content
Glama
listingbureau

Listing Bureau - Amazon Organic Ranking

lb_projects_get_stats

Read-only

Retrieve daily statistics for a project including service execution, SERP rankings, ARA analytics, brand referral, and search query data. Supports up to 365 days of history.

Instructions

Get daily stats for a Listing Bureau project: service execution (SFB, ATC, PGV), SERP rankings, ARA analytics, Brand Referral, and Search Query data. Note: this call may be slow (~1-2s) due to 14+ backend DB queries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ui_idYesProject unique identifier
daysNoNumber of days of history (default 30, max 365)

Implementation Reference

  • Handler for lb_projects_get_stats tool. Registers an MCP tool that accepts ui_id (required) and days (optional, 1-365). Calls GET /api/v1/projects/{ui_id}/stats with optional days query param, returns ProjectStatsResponse.
    server.tool(
      "lb_projects_get_stats",
      "Get daily stats for a Listing Bureau project: service execution (SFB, ATC, PGV), SERP rankings, ARA analytics, Brand Referral, and Search Query data. Note: this call may be slow (~1-2s) due to 14+ backend DB queries.",
      {
        ui_id: z.string().describe("Project unique identifier"),
        days: z
          .number()
          .int()
          .min(1)
          .max(365)
          .optional()
          .describe("Number of days of history (default 30, max 365)"),
      },
      { readOnlyHint: true },
      async (params) => {
        try {
          const query: Record<string, string> = {};
          if (params.days !== undefined) query.days = String(params.days);
    
          const res = await client.request<ProjectStatsResponse>(
            "GET",
            `/api/v1/projects/${encodeURIComponent(params.ui_id)}/stats`,
            undefined,
            query,
            "lb_projects_get_stats",
          );
          return formatResult(res.data);
        } catch (e) {
          return formatErrorResult(e);
        }
      },
    );
  • src/index.ts:58-58 (registration)
    Registration entry point. Called from index.ts to register all project tools including lb_projects_get_stats on the MCP server.
    registerProjectsTools(server, client);
  • Type definition for the response of lb_projects_get_stats. Contains days (number), total (number), and stats (array of ProjectStatsDay).
    export interface ProjectStatsResponse {
      days: number;
      total: number;
      stats: ProjectStatsDay[];
    }
  • Type definition for a single day's stats. Contains date, services (sfb/atc/pgv), serp, ara, br, sqr, and ranks fields.
    export interface ProjectStatsDay {
      date: string;                    // YYYYMMDD
      dt: string | null;               // ISO datetime with timezone
      services: {
        sfb: ServiceDayStats;
        atc: ServiceDayStats;
        pgv: ServiceDayStats;
      };
      serp: Record<string, unknown> | null;
      ara: Record<string, unknown> | null;
      br: Record<string, unknown> | null;
      sqr: Record<string, unknown> | null;
      ranks: unknown[] | null;
    }
    
    export interface ServiceDayStats {
      assignments: number | null;
      executed: number;
    }
  • Generic authenticated request method used by the handler. Handles token refresh, retries on 401, and sends X-LB-Tool header for tracking.
    async request<T>(
      method: string,
      path: string,
      body?: Record<string, unknown>,
      query?: Record<string, string>,
      toolName?: string,
    ): Promise<ApiSuccessResponse<T>> {
      await this.ensureAuth();
      const response = await this.doRequest<T>(method, path, body, query, toolName);
    
      // Single retry on 401
      if (response.status === "error" && response._statusCode === 401) {
        this.jwt = null;
        await this.ensureAuth();
        const retry = await this.doRequest<T>(method, path, body, query, toolName);
        if (retry.status === "error") {
          throw new LBApiError(
            retry._statusCode ?? 500,
            retry.error.code,
            retry.error.message,
          );
        }
        return retry as ApiSuccessResponse<T>;
      }
    
      if (response.status === "error") {
        throw new LBApiError(
          response._statusCode ?? 500,
          response.error.code,
          response.error.message,
        );
      }
    
      return response as ApiSuccessResponse<T>;
    }
Behavior4/5

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

Beyond the readOnlyHint annotation, the description discloses that the call may be slow (~1-2s) due to 14+ backend queries, adding valuable performance context.

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 two sentences, front-loading the purpose and adding a crucial performance note concisely.

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

Completeness4/5

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

Given no output schema, the description adequately lists the types of data retrieved and the performance characteristic, but could mention if results are paginated or if there are limits.

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 covers 100% of parameters with descriptions, so the tool description adds no extra meaning beyond what the schema provides.

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

Purpose5/5

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

The description clearly states the tool gets daily stats for a Listing Bureau project, listing specific data types (SFB, ATC, PGV, SERP rankings, etc.), which distinguishes it from sibling tools like lb_projects_get.

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

Usage Guidelines3/5

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

The description implies usage for retrieving project stats but does not explicitly state when to use this tool over alternatives or provide exclusion criteria.

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

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/listingbureau/listingbureau-mcp'

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