Skip to main content
Glama
alloufj

Grips Intelligence MCP Server

by alloufj

Get daily performance (revenue / transactions / sessions)

grips_get_daily_performance
Read-onlyIdempotent

Retrieve daily revenue, transactions, and sessions timeseries for one or more domains to detect spikes, dips, promo effects, and day-of-week patterns. Supports US, GB, DE. Returns markdown or JSON.

Instructions

Returns a daily timeseries of revenue, transactions, and sessions for one or more domains. Useful for spike/dip detection, promo windows, and day-of-week patterns. Note: Grips only offers daily data for a subset of domains — smaller sites often return empty. Defaults to markdown output.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainsYesOne or more domains (e.g. ['adidas.com', 'nike.com']). Protocol and trailing slash are stripped automatically.
date_fromYesStart of the reporting window, inclusive, as YYYY-MM-DD. Example: '2024-01-01'.
date_toYesEnd of the reporting window, inclusive, as YYYY-MM-DD. Example: '2024-12-31'.
countryNoOptional country filter. Defaults to the server's GRIPS_DEFAULT_COUNTRY (usually 'US').
formatNoResponse format. 'markdown' is human-readable; 'json' is machine-parseable.markdown

Implementation Reference

  • The main handler function `runDailyPerformance` that executes the gripps_get_daily_performance tool logic. It calls the Grips API with DAILY_PERFORMANCE_QUERY, normalizes dates, and returns either JSON or a markdown table with revenue/transactions/sessions timeseries data.
    export async function runDailyPerformance(
      client: GripsApiClient,
      args: DailyPerformanceInput,
      defaultCountry: string,
    ): Promise<string> {
      const country = args.country ?? defaultCountry;
      const variables = buildFilters({
        domains: args.domains,
        date_from: args.date_from,
        date_to: args.date_to,
        country,
      });
    
      let rawData: { performance?: unknown } = {};
      try {
        rawData = await client.query<{ performance?: unknown }>({
          query: DAILY_PERFORMANCE_QUERY,
          variables,
        });
      } catch (err) {
        const msg = formatUpstreamError(err);
        const hint = errorHint(err);
        return `Error: ${msg}${hint ? `\n\nHint: ${hint}` : ""}`;
      }
    
      const rows = toArray<DailyPerformanceRow>(rawData.performance).map((r) => ({
        ...r,
        date: normalizeDate(r?.date),
      }));
    
      if (rows.length === 0) {
        return `**Grips daily performance — ${args.domains.join(", ")} (${country}, ${args.date_from} → ${args.date_to})**\n\n_No daily data returned by Grips. Daily data is only available for a subset of covered domains — try \`grips_get_domain_performance\` for monthly data instead._`;
      }
    
      if (args.format === "json") {
        return toJson({
          domains: args.domains,
          country,
          date_from: args.date_from,
          date_to: args.date_to,
          rows: rows.map((r) => ({
            date: r.date,
            transactionrevenue: safeNumberOrNull(r.transactionrevenue),
            transactions: safeNumberOrNull(r.transactions),
            sessions: safeNumberOrNull(r.sessions),
          })),
        });
      }
    
      const tableRows = rows.map((r) => ({
        Date: r.date,
        Revenue: formatCurrency(r.transactionrevenue),
        Transactions: formatInt(r.transactions),
        Sessions: formatInt(r.sessions),
      }));
    
      const header = `**Grips daily performance — ${args.domains.join(", ")} (${country}, ${args.date_from} → ${args.date_to})**`;
      return truncateIfNeeded(`${header}\n\n${toMarkdownTable(tableRows)}`);
    }
  • src/index.ts:81-90 (registration)
    Registration of the `grips_get_daily_performance` tool via `server.registerTool()`, wiring the tool definition to the `runDailyPerformance` handler.
    server.registerTool(
      dailyPerformanceToolDef.name,
      {
        title: dailyPerformanceToolDef.title,
        description: dailyPerformanceToolDef.description,
        inputSchema: dailyPerformanceToolDef.inputSchema,
        annotations: dailyPerformanceToolDef.annotations,
      },
      async (args) => asText(await runDailyPerformance(client, args as any, defaultCountry)),
    );
  • Input schema (`dailyPerformanceInputSchema`) and tool definition (`dailyPerformanceToolDef`) for gripps_get_daily_performance. Uses `baseFilterFields` (domains, date_from, date_to, country, format).
    export const dailyPerformanceInputSchema = z.object(baseFilterFields);
    export type DailyPerformanceInput = z.infer<typeof dailyPerformanceInputSchema>;
    
    export const dailyPerformanceToolDef = {
      name: "grips_get_daily_performance",
      title: "Get daily performance (revenue / transactions / sessions)",
      description:
        "Returns a daily timeseries of revenue, transactions, and sessions for one or more domains. Useful for spike/dip detection, promo windows, and day-of-week patterns. Note: Grips only offers daily data for a subset of domains — smaller sites often return empty. Defaults to markdown output.",
      inputSchema: baseFilterFields,
      annotations: {
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true,
      },
    };
  • `baseFilterFields` shared schema used by gripps_get_daily_performance, defining domains, date_from, date_to, country, and format fields.
    export const baseFilterFields = {
      domains: domainsArray.describe(
        "One or more domains (e.g. ['adidas.com', 'nike.com']). Protocol and trailing slash are stripped automatically.",
      ),
      date_from: isoDate.describe(
        "Start of the reporting window, inclusive, as YYYY-MM-DD. Example: '2024-01-01'.",
      ),
      date_to: isoDate.describe(
        "End of the reporting window, inclusive, as YYYY-MM-DD. Example: '2024-12-31'.",
      ),
      country: countryEnum
        .optional()
        .describe("Optional country filter. Defaults to the server's GRIPS_DEFAULT_COUNTRY (usually 'US')."),
      format: outputFormat,
    };
    
    /** Convenience: build the `{ filters: {...} }` payload Grips expects. */
    export function buildFilters(args: {
      domains: string[];
      date_from: string;
      date_to: string;
      country?: string;
      channel?: string[];
    }): { filters: Record<string, unknown> } {
      const filters: Record<string, unknown> = {
        domain: { in: args.domains },
        date: { gte: args.date_from, lte: args.date_to },
      };
      if (args.country) filters.country = args.country;
      if (args.channel && args.channel.length > 0) {
        filters.channel = { in: args.channel };
      }
      return { filters };
    }
  • The DAILY_PERFORMANCE_QUERY GraphQL string used by the handler to fetch daily revenue, transactions, and sessions timeseries data from the Grips API.
    /** Daily performance — only available for a subset of domains. */
    export const DAILY_PERFORMANCE_QUERY = `
      input Date {
        gte: String!
        lte: String!
      }
      input OrArray {
        in: [String!]
      }
      input Filters {
        country: String
        domain: OrArray!
        date: Date!
      }
      query domain_performance_daily($filters: Filters) {
        performance: fetch(filters: $filters) {
          date (type: Array, sort_asc: date) {
            transactionrevenue: sum(a:revenue)
            transactions: sum(a:transactions)
            sessions: sum(a:sessions)
          }
        }
      }
    `;
Behavior3/5

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

Annotations already provide safety and idempotency hints. The description adds value by noting the default format (markdown) and the empty result behavior for smaller domains, but doesn't cover auth or rate limits. Burden partially shared with annotations.

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?

Three concise sentences, front-loaded with the main action, followed by use cases and a critical caveat. No wasted words.

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?

Despite lacking an output schema, the description adequately explains the return shape (daily timeseries of specific metrics) and important caveats (empty results). For a straightforward time-series tool, this is nearly complete.

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 covers all 5 parameters with 100% coverage, so baseline is 3. The description adds minimal extra meaning beyond the schema, such as implying daily granularity and the empty result hint, but does not significantly enhance parameter understanding.

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?

Description clearly states the tool returns a daily timeseries of revenue, transactions, and sessions for one or more domains, with specific use cases (spike/dip detection, promo windows, day-of-week patterns). It distinguishes from siblings like grips_get_domain_performance (likely aggregate) and grips_compare_domains (comparison).

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

Usage Guidelines4/5

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

Provides explicit use cases and notes data availability limitations ('smaller sites often return empty'), but does not name alternative tools for exclusion. The context helps an agent decide when to use this tool.

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/alloufj/grips-mcp-server'

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