search_perfumes
Find perfumes by name or brand using the Blue Perfumery MCP Server. Enter a search query to explore the fragrance collection and access relevant purchase options.
Instructions
Search perfumes by name or brand
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for perfume name or brand |
Implementation Reference
- src/index.ts:160-192 (handler)The handler function for the 'search_perfumes' tool. It validates the query input, performs a case-insensitive regex search on the Product collection's name, brand, and description fields for active products, and returns the results as JSON.case "search_perfumes": { const { query } = args as { query: string }; if (!query) { throw new McpError( ErrorCode.InvalidParams, "Query parameter is required" ); } const results = await Product.find({ status: "active", $or: [ { name: { $regex: query, $options: "i" } }, { brand: { $regex: query, $options: "i" } }, { description: { $regex: query, $options: "i" } }, ], }).lean(); return { content: [ { type: "text", text: JSON.stringify({ success: true, query: query, count: results.length, perfumes: results, }, null, 2), }, ], }; }
- src/index.ts:52-65 (schema)The input schema and metadata definition for the 'search_perfumes' tool, including name, description, and required 'query' string parameter.{ name: "search_perfumes", description: "Search perfumes by name or brand", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query for perfume name or brand", }, }, required: ["query"], }, },
- src/index.ts:26-97 (registration)The tool registration within the ListToolsRequestSchema handler, where 'search_perfumes' is listed among available tools.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "list_all_perfumes", description: "List all perfumes in the Blue Perfumery collection", inputSchema: { type: "object", properties: {}, required: [], }, }, { name: "get_perfume_by_id", description: "Get a specific perfume by its ID", inputSchema: { type: "object", properties: { id: { type: "string", description: "The perfume ID", }, }, required: ["id"], }, }, { name: "search_perfumes", description: "Search perfumes by name or brand", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query for perfume name or brand", }, }, required: ["query"], }, }, { name: "get_perfumes_by_category", description: "Get perfumes by category (men, women, niche)", inputSchema: { type: "object", properties: { category: { type: "string", description: "Category: 'men', 'women', or 'niche'", enum: ["men", "women", "niche"], }, }, required: ["category"], }, }, { name: "get_purchase_link", description: "Get the Shopier purchase link for a specific perfume", inputSchema: { type: "object", properties: { id: { type: "string", description: "The perfume ID", }, }, required: ["id"], }, }, ], }; });