Skip to main content
Glama

find_product

Locate where to buy or access digital products like music and games. Automatically identifies product type and directs to appropriate purchasing or streaming platforms.

Instructions

Find the best place to buy or access any digital product (music, games, etc). Automatically detects the product category and routes to the right resolver. Use this when you're not sure whether the user is asking about music or games, or when the query is ambiguous.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesA natural language product query. Examples: 'Aphex Twin Windowlicker', 'Elden Ring DLC', 'where can I stream Bad Guy by Billie Eilish'
categoryNoProduct category. Use 'auto' (default) to let RootVine detect the category automatically.

Implementation Reference

  • Main handler function findProduct that routes product queries to the appropriate resolver (music or game) based on category detection or user-specified category
    export async function findProduct(input: FindProductInput): Promise<FindProductResult> {
        const { query } = input;
        const category = input.category === "auto" || !input.category
            ? detectCategory(query)
            : input.category;
    
        const slug = queryToSlug(query);
    
        if (category === "music") {
            const result = await resolveMusic({ slug });
            return {
                success: result.success,
                category: "music",
                response: result.response,
                formatted: result.response
                    ? formatMusicResponse(result.response)
                    : `❌ ${result.error || "Unknown error"}`,
                error: result.error,
            };
        }
    
        if (category === "game") {
            const result = await resolveGame({ slug });
            return {
                success: result.success,
                category: "game",
                response: result.response,
                formatted: result.response
                    ? formatGameResponse(result.response)
                    : `❌ ${result.error || "Unknown error"}`,
                error: result.error,
            };
        }
    
        return {
            success: false,
            category: "music",
            formatted: `❌ Unknown category: ${category}`,
            error: `Unknown category: ${category}`,
        };
    }
  • Type definitions for FindProductInput (query string and optional category) and FindProductResult (success status, detected category, response, formatted output, and optional error)
    export interface FindProductInput {
        query: string;
        category?: "music" | "game" | "auto";
    }
    
    export interface FindProductResult {
        success: boolean;
        category: "music" | "game";
        response?: RootVineResponseV1;
        formatted: string;
        error?: string;
    }
  • src/index.ts:125-154 (registration)
    MCP tool registration for 'find_product' with input schema validation using Zod and the handler that wraps findProduct function and returns formatted text response
    server.registerTool(
        "find_product",
        {
            description: "Find the best place to buy or access any digital product (music, games, etc). Automatically detects the product category and routes to the right resolver. Use this when you're not sure whether the user is asking about music or games, or when the query is ambiguous.",
            inputSchema: {
                query: z
                    .string()
                    .describe("A natural language product query. Examples: 'Aphex Twin Windowlicker', 'Elden Ring DLC', 'where can I stream Bad Guy by Billie Eilish'"),
                category: z
                    .enum(["music", "game", "auto"])
                    .optional()
                    .describe("Product category. Use 'auto' (default) to let RootVine detect the category automatically."),
            },
        },
        async ({ query, category }) => {
            const result = await findProduct({
                query,
                category: category || "auto",
            });
    
            return {
                content: [
                    {
                        type: "text" as const,
                        text: result.formatted,
                    },
                ],
            };
        },
    );
  • Helper function detectCategory that analyzes query text for keywords to determine if the product is a game or music item, defaulting to music
    function detectCategory(query: string): "music" | "game" {
        const q = query.toLowerCase();
    
        // Game indicators
        const gameKeywords = [
            "game", "dlc", "expansion", "steam", "xbox", "playstation",
            "ps5", "ps4", "nintendo", "switch", "pc game", "goty",
            "edition", "gameplay",
        ];
        for (const kw of gameKeywords) {
            if (q.includes(kw)) return "game";
        }
    
        // Music indicators (default — music is more common for now)
        const musicKeywords = [
            "song", "album", "track", "listen", "stream", "spotify",
            "apple music", "vinyl", "single", "ep ", "lp ",
            "feat", "ft.", "remix", "acoustic",
        ];
        for (const kw of musicKeywords) {
            if (q.includes(kw)) return "music";
        }
    
        // Default to music (BeatsVine is the first tree)
        return "music";
    }
  • Helper function queryToSlug that normalizes a query string into a URL-safe slug by converting to lowercase, removing special chars, and replacing spaces with hyphens
    function queryToSlug(query: string): string {
        return query
            .toLowerCase()
            .trim()
            .replace(/[^a-z0-9\s-]/g, "") // Remove special chars
            .replace(/\s+/g, "-")          // Spaces to hyphens
            .replace(/-+/g, "-")           // Collapse multiple hyphens
            .replace(/^-|-$/g, "");        // Trim leading/trailing hyphens
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: automatic category detection, routing to resolvers, and handling ambiguous queries. However, it lacks details on permissions, rate limits, error handling, or what 'best place' means (e.g., price comparison, availability).

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 efficiently structured in two sentences: the first states the purpose and key features, the second provides clear usage guidelines. Every sentence earns its place with no wasted words, making it easy to parse and front-loaded with essential information.

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

Completeness3/5

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

Given no annotations and no output schema, the description adequately covers the tool's purpose and usage context. However, for a tool that likely returns complex results (e.g., product listings, prices), the lack of output details or behavioral specifics (like what 'best place' entails) leaves gaps in completeness.

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 description coverage is 100%, so the schema fully documents both parameters. The description adds minimal value beyond the schema: it implies 'query' is for product searches and 'category' defaults to 'auto' for detection, but doesn't provide additional syntax or format details. Baseline 3 is appropriate when schema does the heavy lifting.

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 clearly states the tool's purpose: 'Find the best place to buy or access any digital product' with specific examples (music, games). It distinguishes from siblings by mentioning automatic category detection and routing, but doesn't explicitly name the sibling tools (resolve_game, resolve_music) for direct comparison.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'Use this when you're not sure whether the user is asking about music or games, or when the query is ambiguous.' This clearly differentiates it from the sibling tools (resolve_game, resolve_music) which presumably handle specific categories.

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/RagingOrangutan/rootvine-mcp'

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