Skip to main content
Glama
rogertheunissenmerge-oss

SommelierX Wine Pairing MCP

search_meals

Search the database by meal name or keyword to discover available dishes for wine pairing.

Instructions

Search for meals and dishes in the SommelierX database. Returns meal names, IDs, and descriptions. Use this to discover available meals before using pair_wine_with_meal or group_pairing. Best for: "What pasta dishes are in the database?" | Auth: API key (Bearer sk_live_...) or x402 payment (USDC on Base) | Price: $0.005/call

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term for meals/dishes (e.g. "risotto", "steak", "sushi")
languageNoLanguage code for results (e.g. "en", "nl", "fr"). Defaults to "en".

Implementation Reference

  • The main execution function for the search_meals tool. Calls /api/v1/meals?search=... with the query and language, then formats the results. Handles errors and delegates formatting to formatMealResults.
    export async function executeSearchMeals(
      client: SommelierXClient,
      config: ServerConfig,
      input: SearchMealsInput,
    ): Promise<string> {
      const language = input.language ?? config.defaultLanguage;
    
      let result: MealListResult;
      try {
        result = await client.get<MealListResult>('/api/v1/meals', {
          search: input.query,
          language,
          perPage: '20',
        });
      } catch (error: unknown) {
        const message = error instanceof Error ? error.message : 'Unknown error';
        return `Error searching meals: ${message}`;
      }
    
      return formatMealResults(input.query, result.data, result.total);
    }
  • Zod schema for search_meals input validation. Accepts 'query' (string, min 2 chars) and optional 'language' (string, 2-10 chars).
    export const searchMealsSchema = z.object({
      query: z
        .string()
        .min(2, 'Search query must be at least 2 characters')
        .max(100)
        .describe('Search term for meals/dishes (e.g. "risotto", "steak", "sushi")'),
      language: z
        .string()
        .min(2)
        .max(10)
        .optional()
        .describe('Language code for results (e.g. "en", "nl", "fr"). Defaults to "en".'),
    });
  • src/index.ts:134-145 (registration)
    Registration of the 'search_meals' tool on the MCP server via server.tool(). Imports searchMealsSchema and executeSearchMeals, sets up the handler that parses input and calls executeSearchMeals.
    // ── Tool 6: search_meals ──
    
    server.tool(
      'search_meals',
      'Search for meals and dishes in the SommelierX database. Returns meal names, IDs, and descriptions. Use this to discover available meals before using pair_wine_with_meal or group_pairing. Best for: "What pasta dishes are in the database?" | Auth: API key (Bearer sk_live_...) or x402 payment (USDC on Base) | Price: $0.005/call',
      searchMealsSchema.shape,
      async (input) => {
        const parsed = searchMealsSchema.parse(input);
        const result = await executeSearchMeals(client, config, parsed);
        return { content: [{ type: 'text' as const, text: result }] };
      },
    );
  • Helper function that formats meal search results into a human-readable string. Lists each meal with name, id, and optional description. Handles empty results and pagination messaging.
    function formatMealResults(
      query: string,
      meals: MealItem[],
      total: number,
    ): string {
      const lines: string[] = [];
    
      lines.push(`Meal search results for "${query}" (${total} total):`);
      lines.push('');
    
      if (meals.length === 0) {
        lines.push('No meals found matching your search.');
        lines.push('Try a different search term or language.');
        return lines.join('\n');
      }
    
      for (const meal of meals) {
        lines.push(`- ${meal.name} (id: ${meal.id})`);
        if (meal.description) {
          lines.push(`  ${meal.description}`);
        }
      }
    
      if (total > meals.length) {
        lines.push('');
        lines.push(`Showing ${meals.length} of ${total} results. Refine your search for more specific results.`);
      }
    
      return lines.join('\n');
    }
  • Type definitions used by search_meals: MealItem interface (id, name, description, ingredients) and MealListResult interface (data array with pagination fields total, page, perPage).
    /** Meal from search/list. */
    export interface MealItem {
      id: number;
      name: string;
      description?: string;
      ingredients?: Array<{
        id: number;
        name: string;
        amount?: string;
      }>;
    }
    
    /** Paginated meal list. */
    export interface MealListResult {
      data: MealItem[];
      total: number;
      page: number;
      perPage: number;
    }
Behavior4/5

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

Given no annotations, description discloses authentication (API key or x402 payment) and pricing ($0.005/call). Mentions return fields. Lacks details on pagination or limits, but adequate for a simple 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.

Conciseness5/5

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

Three sentences, front-loaded with purpose, then usage context, then best-for/auth/pricing. No wasted words.

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?

Covers purpose, return fields, usage context, authentication, pricing, and an example. No output schema needed; description is complete for a simple search tool.

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 coverage is 100% so baseline is 3. Description adds example query context but does not significantly enhance parameter meaning beyond schema descriptions.

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?

Clearly states verb (Search), resource (meals/dishes in SommelierX database), and return fields (names, IDs, descriptions). Provides example query. Explicitly distinguishes from sibling tools by mentioning usage before pair_wine_with_meal or group_pairing.

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?

Explicitly states when to use: 'Use this to discover available meals before using pair_wine_with_meal or group_pairing.' Provides best-for example. Does not explicitly state when not to use, but context is clear.

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/rogertheunissenmerge-oss/mcp-server'

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