Skip to main content
Glama

getProduct

Retrieve detailed product information from the Omnisend marketing platform using a unique identifier to access specific product data for management and tracking operations.

Instructions

Retrieve detailed information about a specific product by its unique identifier.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'getProduct' tool. It calls the underlying API function, applies field filtering, and returns the product data as formatted JSON text in the MCP response format.
    async (args) => { try { const response = await getProduct(args.productId); // Filter product data to include only defined fields const filteredProduct = filterProductFields(response); return { content: [ { type: "text", text: JSON.stringify(filteredProduct, null, 2) } ] }; } catch (error) { if (error instanceof Error) { return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } return { content: [{ type: "text", text: "An unknown error occurred" }] }; } }
  • Input schema validation for the 'getProduct' tool, specifying that a 'productId' string is required.
    { additionalProperties: false, properties: { productId: { description: "Product ID", type: "string" } }, required: ["productId"], type: "object" },
  • Registration of the 'getProduct' tool on the MCP server using server.tool(), including name, description, schema, and handler.
    server.tool( "getProduct", "Retrieve detailed information about a specific product by its unique identifier.", { additionalProperties: false, properties: { productId: { description: "Product ID", type: "string" } }, required: ["productId"], type: "object" }, async (args) => { try { const response = await getProduct(args.productId); // Filter product data to include only defined fields const filteredProduct = filterProductFields(response); return { content: [ { type: "text", text: JSON.stringify(filteredProduct, null, 2) } ] }; } catch (error) { if (error instanceof Error) { return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } return { content: [{ type: "text", text: "An unknown error occurred" }] }; } } );
  • Supporting API utility function that performs the HTTP GET request to retrieve product details from the Omnisend API.
    export const getProduct = async (productId: string): Promise<Product> => { try { const response = await omnisendApi.get<Product>(`/products/${productId}`); return response.data; } catch (error) { if (error instanceof Error) { throw new Error(`Error getting product information: ${error.message}`); } else { throw new Error('Unknown error occurred when getting product'); } } };

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/plutzilla/omnisend-mcp'

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