Skip to main content
Glama

find_product

Resolves product queries to the best streaming, purchase, or collection source. Automatically detects category and routes to the right provider for music, games, and more.

Instructions

Smart router — finds the best place to stream, buy, or collect any supported product. Automatically detects the product category and routes to the right resolver. Music is live (stream, digital purchase, vinyl, CD, collector editions). Games, books, films, podcasts, and live event tickets are rolling out. Use this when the query is ambiguous or when music could be streamed, purchased digitally, or found on physical media.

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 for the find_product tool. Routes queries by category (music/game) by calling resolveMusic or resolveGame, and returns a formatted result string.
    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}`,
        };
    }
  • Input/output type definitions for find_product: FindProductInput (query string + optional category enum) and FindProductResult (success, category, response, formatted string, 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:126-155 (registration)
    MCP registration of the 'find_product' tool with description, input schema (query string + optional category enum), and async handler that delegates to the findProduct function.
    server.registerTool(
        "find_product",
        {
            description: "Smart router — finds the best place to stream, buy, or collect any supported product. Automatically detects the product category and routes to the right resolver. Music is live (stream, digital purchase, vinyl, CD, collector editions). Games, books, films, podcasts, and live event tickets are rolling out. Use this when the query is ambiguous or when music could be streamed, purchased digitally, or found on physical media.",
            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,
                    },
                ],
            };
        },
    );
  • Category detection helper: scans query text for game-related keywords (game, steam, xbox, etc.) or music keywords (song, album, stream, etc.) to auto-classify products.
    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";
    }
  • Query-to-slug normalization helper: lowercases, trims, removes special chars, converts spaces to 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
    }
Behavior4/5

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

No annotations are provided, so the description must fully disclose behavior. It explains auto-detection of product category, routing to resolvers, and states which categories are live and which are rolling out. It lacks explicit details on authentication or rate limits, but for a non-destructive routing tool, this is reasonably transparent.

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 and well-structured, starting with the core purpose ('Smart router'), then detailing supported categories and usage guidance. Every sentence adds value without redundancy.

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?

Given the tool's complexity (routing, multiple categories) and lack of output schema, the description adequately explains behavior, status, and when to use. It could mention fallback behavior for unsupported categories, but overall it is complete enough for an agent to use correctly.

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 has 100% coverage with descriptions for both parameters. The description adds context by explaining the 'query' parameter with natural language examples and the 'category' enum with the 'auto' default. This exceeds the baseline of 3 by providing meaningful usage context.

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 explicitly states it is a 'Smart router' that finds the best place to stream, buy, or collect products. It specifies the product categories (music, games, etc.) and clearly distinguishes from sibling tools like discover_music, resolve_game, and resolve_music.

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: 'Use this when the query is ambiguous or when music could be streamed, purchased digitally, or found on physical media.' It also explains the category parameter's auto-detect behavior, helping the agent decide when to use this tool over 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/RagingOrangutan/rootvine-mcp'

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