Skip to main content
Glama

search_products

Search for products on Rakuten Ichiba by keyword, with optional filters for price range, sort order, and pagination.

Instructions

Search for products on Rakuten Ichiba (Japan's largest e-commerce marketplace)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYesSearch keyword (Japanese or English)
hitsNoNumber of results (1-30)
pageNoPage number
sortNoSort order (prefix + for ascending, - for descending)standard
minPriceNoMinimum price in yen
maxPriceNoMaximum price in yen

Implementation Reference

  • src/index.ts:92-163 (registration)
    The tool 'search_products' is registered with the MCP server via server.tool() call. This is where the tool name, description, Zod schema for inputs, and handler function are all defined together.
    server.tool(
      "search_products",
      "Search for products on Rakuten Ichiba (Japan's largest e-commerce marketplace)",
      {
        keyword: z.string().describe("Search keyword (Japanese or English)"),
        hits: z
          .number()
          .min(1)
          .max(30)
          .default(10)
          .describe("Number of results (1-30)"),
        page: z.number().min(1).default(1).describe("Page number"),
        sort: z
          .enum([
            "standard",
            "+affiliateRate",
            "-affiliateRate",
            "+reviewCount",
            "-reviewCount",
            "+reviewAverage",
            "-reviewAverage",
            "+itemPrice",
            "-itemPrice",
            "+updateTimestamp",
            "-updateTimestamp",
          ])
          .default("standard")
          .describe("Sort order (prefix + for ascending, - for descending)"),
        minPrice: z.number().optional().describe("Minimum price in yen"),
        maxPrice: z.number().optional().describe("Maximum price in yen"),
      },
      async ({ keyword, hits, page, sort, minPrice, maxPrice }) => {
        const params: Record<string, string> = {
          keyword,
          hits: String(hits),
          page: String(page),
          sort,
        };
        if (minPrice !== undefined) params.minPrice = String(minPrice);
        if (maxPrice !== undefined) params.maxPrice = String(maxPrice);
    
        const data = (await rakutenRequest(
          ENDPOINTS.ichibaItemSearch,
          params
        )) as { count?: number; Items?: Array<{ Item: Record<string, unknown> }> };
    
        const items =
          data.Items?.map((i) => ({
            name: i.Item.itemName,
            price: i.Item.itemPrice,
            url: i.Item.itemUrl,
            shop: i.Item.shopName,
            reviewAverage: i.Item.reviewAverage,
            reviewCount: i.Item.reviewCount,
            imageUrl: (i.Item.mediumImageUrls as Array<{ imageUrl: string }>)?.[0]
              ?.imageUrl,
          })) ?? [];
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { totalCount: data.count, items },
                null,
                2
              ),
            },
          ],
        };
      }
    );
  • The handler function for search_products. It builds query parameters from inputs, calls the Rakuten Ichiba Item Search API via rakutenRequest, extracts item data from the response, and returns a formatted JSON result with totalCount and items.
    async ({ keyword, hits, page, sort, minPrice, maxPrice }) => {
      const params: Record<string, string> = {
        keyword,
        hits: String(hits),
        page: String(page),
        sort,
      };
      if (minPrice !== undefined) params.minPrice = String(minPrice);
      if (maxPrice !== undefined) params.maxPrice = String(maxPrice);
    
      const data = (await rakutenRequest(
        ENDPOINTS.ichibaItemSearch,
        params
      )) as { count?: number; Items?: Array<{ Item: Record<string, unknown> }> };
    
      const items =
        data.Items?.map((i) => ({
          name: i.Item.itemName,
          price: i.Item.itemPrice,
          url: i.Item.itemUrl,
          shop: i.Item.shopName,
          reviewAverage: i.Item.reviewAverage,
          reviewCount: i.Item.reviewCount,
          imageUrl: (i.Item.mediumImageUrls as Array<{ imageUrl: string }>)?.[0]
            ?.imageUrl,
        })) ?? [];
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              { totalCount: data.count, items },
              null,
              2
            ),
          },
        ],
      };
    }
  • Zod input schema for search_products defining keyword (string), hits (1-30, default 10), page (min 1, default 1), sort (enum with standard/affiliate/price/review/update options, default 'standard'), minPrice (optional number), and maxPrice (optional number).
    {
      keyword: z.string().describe("Search keyword (Japanese or English)"),
      hits: z
        .number()
        .min(1)
        .max(30)
        .default(10)
        .describe("Number of results (1-30)"),
      page: z.number().min(1).default(1).describe("Page number"),
      sort: z
        .enum([
          "standard",
          "+affiliateRate",
          "-affiliateRate",
          "+reviewCount",
          "-reviewCount",
          "+reviewAverage",
          "-reviewAverage",
          "+itemPrice",
          "-itemPrice",
          "+updateTimestamp",
          "-updateTimestamp",
        ])
        .default("standard")
        .describe("Sort order (prefix + for ascending, - for descending)"),
      minPrice: z.number().optional().describe("Minimum price in yen"),
      maxPrice: z.number().optional().describe("Maximum price in yen"),
    },
  • The rakutenRequest helper function used by the handler to make HTTP requests to the Rakuten API, handling authentication (appId, accessKey), headers (Origin/Referer), and response parsing.
    async function rakutenRequest(
      endpointUrl: string,
      params: Record<string, string> = {}
    ): Promise<unknown> {
      const appId = getAppId();
      const accessKey = getAccessKey();
      const origin = getOrigin();
      const searchParams = new URLSearchParams({
        applicationId: appId,
        accessKey,
        format: "json",
        ...params,
      });
      const url = `${endpointUrl}?${searchParams}`;
      const res = await fetch(url, {
        headers: {
          Origin: origin,
          Referer: origin,
        },
      });
    
      if (!res.ok) {
        const status = res.status;
        const body = await res.text();
        throw new Error(`Rakuten API error (HTTP ${status}) on ${endpointUrl}: ${body.slice(0, 200)}`);
      }
    
      const text = await res.text();
      if (!text) return { success: true };
      try {
        return JSON.parse(text);
      } catch {
        throw new Error(`Rakuten API returned malformed JSON on ${endpointUrl}`);
      }
    }
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 only states the basic purpose, omitting traits like pagination behavior, rate limits, authentication requirements, or data freshness. This is insufficient for a search tool.

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

Conciseness4/5

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

The description is a single concise sentence with no extraneous information. However, it could benefit from slightly more detail without sacrificing brevity.

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 output schema and annotations, and the tool's moderate complexity (6 parameters), the description is insufficient. It fails to explain pagination, defaults, or what the results contain, leaving gaps for the agent.

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, so the schema already provides clear meanings for all parameters. The description adds no additional semantic value beyond what the schema offers, landing at the baseline score.

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 action ('Search'), the resource ('products'), and the specific marketplace ('Rakuten Ichiba'). This immediately distinguishes it from sibling tools like search_books or search_travel.

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?

No guidance is given on when to use this tool versus alternatives, nor are any prerequisites or exclusions mentioned. The agent must infer usage from the name and context.

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/mrslbt/rakuten-mcp'

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