Skip to main content
Glama

Price History Link (Keepa)

price_history_link
Read-onlyIdempotent

Builds a Keepa price history URL for any Amazon.in ASIN, providing offline access to historical price charts.

Instructions

Build a Keepa.com price-history URL for an amazon.in ASIN. No network call.

Keepa renders historical price charts in the browser using the format keepa.com/#!product/12-, where 12 is the amazon.in domain code. This tool is offline — just a deterministic URL builder.

Args:

  • asin_or_url (string): plain ASIN or amazon.in URL containing /dp/

Returns: JSON { "asin": string, "price_history_url": string }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
asin_or_urlYesASIN or amazon.in URL — Keepa link is built for the amazon.in domain

Implementation Reference

  • The handler function for the price_history_link tool. Extracts ASIN from input, builds Keepa URL via keepaUrl(), and returns the result.
      async (params) => {
        const asin = extractAsinFromUrl(params.asin_or_url.trim());
        if (!asin) {
          return {
            content: [
              {
                type: "text",
                text:
                  "Error: Could not extract ASIN. Pass a 10-character ASIN or an amazon.in URL containing /dp/<ASIN>.",
              },
            ],
          };
        }
        const output = { asin, price_history_url: keepaUrl(asin) };
        return {
          content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
          structuredContent: output,
        };
      }
    );
  • Zod schema for price_history_link input: requires a single 'asin_or_url' string (10-2048 chars).
    const PriceHistoryInputSchema = z
      .object({
        asin_or_url: z
          .string()
          .min(10)
          .max(2048)
          .describe("ASIN or amazon.in URL — Keepa link is built for the amazon.in domain"),
      })
      .strict();
  • src/index.ts:307-350 (registration)
    Registration of the 'price_history_link' tool on the MCP server with input schema and annotations.
    server.registerTool(
      "price_history_link",
      {
        title: "Price History Link (Keepa)",
        description: `Build a Keepa.com price-history URL for an amazon.in ASIN. No network call.
    
    Keepa renders historical price charts in the browser using the format keepa.com/#!product/12-<ASIN>, where 12 is the amazon.in domain code. This tool is offline — just a deterministic URL builder.
    
    Args:
      - asin_or_url (string): plain ASIN or amazon.in URL containing /dp/<ASIN>
    
    Returns: JSON
      {
        "asin": string,
        "price_history_url": string
      }`,
        inputSchema: PriceHistoryInputSchema.shape,
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
      },
      async (params) => {
        const asin = extractAsinFromUrl(params.asin_or_url.trim());
        if (!asin) {
          return {
            content: [
              {
                type: "text",
                text:
                  "Error: Could not extract ASIN. Pass a 10-character ASIN or an amazon.in URL containing /dp/<ASIN>.",
              },
            ],
          };
        }
        const output = { asin, price_history_url: keepaUrl(asin) };
        return {
          content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
          structuredContent: output,
        };
      }
    );
  • The keepaUrl() helper that builds the Keepa.com price-history URL using KEEPA_DOMAIN_CODE (12 for amazon.in).
    export function keepaUrl(asin: string): string {
      return `https://keepa.com/#!product/${KEEPA_DOMAIN_CODE}-${asin}`;
    }
  • The extractAsinFromUrl() helper that extracts a 10-char ASIN from plain input or amazon.in URL.
    export function extractAsinFromUrl(input: string): string | undefined {
      if (ASIN_REGEX.test(input)) return input;
      const match = input.match(ASIN_FROM_URL_REGEX);
      return match?.[1]?.toUpperCase();
    }
Behavior5/5

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

Annotations already provide readOnlyHint, destructiveHint, idempotentHint, and openWorldHint. The description adds that it is offline and makes no network call, providing behavioral context beyond annotations without contradiction.

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 concise, uses a clear structure with a summary sentence followed by details and Args/Returns sections, and every sentence adds value with no redundancy.

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

Completeness5/5

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

Given the tool's simplicity, the description fully covers its purpose, behavior, input format, and return structure. Annotations provide complete behavioral context. No output schema, but the return format is described in JSON.

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

Parameters4/5

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

The input schema already describes the parameter with minLength, maxLength, and a description. The description adds that the input can be a plain ASIN or amazon.in URL containing '/dp/<ASIN>', clarifying acceptable formats beyond the schema's generic description.

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 it builds a Keepa.com price-history URL for an amazon.in ASIN, distinguishing itself from siblings like 'get_product' and 'search_amazon_in' by explicitly noting it's offline and does no network call.

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?

The description explicitly says 'No network call' and 'This tool is offline — just a deterministic URL builder', implying it should be used when only a URL is needed, not actual data. However, it does not explicitly state when not to use it or mention alternatives.

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/justadityaraj/amazon-in-mcp'

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