Skip to main content
Glama

search_genres

Browse Rakuten Ichiba product categories by specifying a genre ID. Start from top-level genres with ID 0 or navigate subcategories.

Instructions

Browse Rakuten Ichiba product categories/genres

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
genreIdNoParent genre ID (0 for top-level)0

Implementation Reference

  • src/index.ts:194-227 (registration)
    Registration of the 'search_genres' tool on the MCP server via server.tool(), which both registers the tool and defines its handler inline.
    server.tool(
      "search_genres",
      "Browse Rakuten Ichiba product categories/genres",
      {
        genreId: z
          .string()
          .default("0")
          .describe("Parent genre ID (0 for top-level)"),
      },
      async ({ genreId }) => {
        const data = (await rakutenRequest(ENDPOINTS.ichibaGenreSearch, {
          genreId,
        })) as {
          current?: Record<string, unknown>;
          children?: Array<{ child: Record<string, unknown> }>;
        };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  current: data.current,
                  children: data.children?.map((c) => c.child),
                },
                null,
                2
              ),
            },
          ],
        };
      }
    );
  • Zod schema for the 'search_genres' tool input: genreId (string, default '0') describing the parent genre ID.
    {
      genreId: z
        .string()
        .default("0")
        .describe("Parent genre ID (0 for top-level)"),
    },
  • The async handler function that calls the Rakuten Ichiba Genre Search API with the genreId, then returns the current genre and its children as JSON.
    async ({ genreId }) => {
      const data = (await rakutenRequest(ENDPOINTS.ichibaGenreSearch, {
        genreId,
      })) as {
        current?: Record<string, unknown>;
        children?: Array<{ child: Record<string, unknown> }>;
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                current: data.current,
                children: data.children?.map((c) => c.child),
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • The endpoint constant ichibaGenreSearch used by the search_genres tool to make the API request.
    ichibaGenreSearch: "https://openapi.rakuten.co.jp/ichibagt/api/IchibaGenre/Search/20170711",
  • The rakutenRequest helper function used by the search_genres handler to make authenticated HTTP requests to Rakuten APIs.
    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?

No annotations provided, and the description lacks behavioral details (e.g., whether it lists all genres, requires authentication, or is read-only). Minimal information.

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

Conciseness3/5

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

The description is a single sentence, making it concise. However, it lacks structure (no title) and is too brief to fully cover the tool's purpose and usage.

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 simple tool with one parameter and no annotations, a more complete description (at least 2-3 sentences) would be expected to explain results and usage. Current description is insufficient.

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 for its single parameter. The tool description adds no extra meaning beyond the schema, so baseline of 3 is appropriate.

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

Purpose4/5

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

The description states the tool browses product categories/genres. The verb 'browse' is somewhat vague but the resource is clear. It distinguishes from sibling search tools that deal with products or rankings.

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 on when to use this tool versus siblings like get_genre_ranking or search_products. No usage context provided.

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