Skip to main content
Glama
recepgocmen

Blue Perfumery MCP Server

by recepgocmen

get_perfume_by_id

Retrieve detailed information about a specific perfume from the Blue Perfumery collection by providing its unique ID, enabling precise fragrance selection and comparison.

Instructions

Get a specific perfume by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe perfume ID

Implementation Reference

  • The core handler logic for the 'get_perfume_by_id' tool. It extracts the 'id' from arguments, validates it, queries the MongoDB Product collection for a matching active perfume, and returns a standardized JSON response via MCP content block.
    case "get_perfume_by_id": {
      const { id } = args as { id: string };
      
      if (!id) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "ID parameter is required"
        );
      }
    
      const perfume = await Product.findOne({ id, status: "active" }).lean();
      
      if (!perfume) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: false,
                error: `Perfume with ID '${id}' not found`,
              }, null, 2),
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              success: true,
              perfume: perfume,
            }, null, 2),
          },
        ],
      };
    }
  • Tool schema definition including name, description, and input validation schema requiring a 'id' string parameter. Returned by the ListToolsRequest handler.
    {
      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"],
      },
    },
  • src/index.ts:26-97 (registration)
    Registration of all tools, including 'get_perfume_by_id', via the ListToolsRequestSchema handler which dynamically returns the tools list with schemas.
    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"],
            },
          },
        ],
      };
    });
  • Unused helper function that retrieves a perfume by ID from the in-memory mock data array, matching the tool name.
    export function getPerfumeById(id: string): Perfume | undefined {
      return perfumes.find(p => p.id === id);
    }
Install Server

Other Tools

Related 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/recepgocmen/blue-perfumery-mcp-server'

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