Skip to main content
Glama
wspotter

MCP Art Supply Store

by wspotter

calculate_profit_margin

Calculate profit margin for art supplies using cost and selling price to determine product profitability and inform pricing decisions.

Instructions

Calculate profit margin for a product or category based on cost and selling price.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
costPriceYesCost price per unit
skuYesProduct SKU

Implementation Reference

  • Handler implementation for calculate_profit_margin tool. Looks up product by SKU from mock inventory data, calculates profit per unit and profit margin percentage, and formats a detailed analysis response including potential revenue from current stock.
    case 'calculate_profit_margin': {
      const sku = String(args?.sku || '');
      const costPrice = Number(args?.costPrice || 0);
      const item = storeData.inventory.find(i => i.id === sku);
      
      if (!item) {
        return { content: [{ type: 'text', text: `❌ Product ${sku} not found` }] };
      }
      
      const profit = item.price - costPrice;
      const margin = (profit / item.price) * 100;
      
      return {
        content: [{
          type: 'text',
          text: `💰 Profit Analysis: ${item.name}\n\n- Selling Price: $${item.price}\n- Cost Price: $${costPrice.toFixed(2)}\n- Profit per Unit: $${profit.toFixed(2)}\n- Profit Margin: ${margin.toFixed(1)}%\n- Potential Revenue (current stock): $${(item.quantity * profit).toFixed(2)}`
        }]
      };
    }
  • Tool schema definition including name, description, and input schema requiring 'sku' (string) and 'costPrice' (number). This is part of the tools array returned by ListToolsRequestHandler.
    {
      name: 'calculate_profit_margin',
      description: 'Calculate profit margin for a product or category based on cost and selling price.',
      inputSchema: {
        type: 'object',
        properties: {
          sku: { type: 'string', description: 'Product SKU' },
          costPrice: { type: 'number', description: 'Cost price per unit' },
        },
        required: ['sku', 'costPrice'],
      },
    },
  • src/index.ts:516-518 (registration)
    Registration of all tools (including calculate_profit_margin via the 'tools' array) for the ListTools MCP request.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • src/dashboard.ts:50-50 (registration)
    Mock tool listing/registration for dashboard display purposes.
    { name: 'calculate_profit_margin', description: 'Calculate profitability', category: 'Sales & Analytics' },
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states it 'calculates' profit margin, implying a read-only operation, but doesn't disclose behavioral traits such as whether it requires specific permissions, how it handles missing data, or what the output format might be. For a calculation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the key action and resource. It avoids unnecessary words, though it could be slightly more precise (e.g., clarifying the missing 'sellingPrice' parameter). Overall, it's appropriately sized with no wasted content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a calculation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., percentage, value), how errors are handled, or dependencies on other data. With 2 parameters and 100% schema coverage, the input is covered, but the overall context lacks sufficient detail for reliable use.

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?

The input schema has 100% description coverage, with 'costPrice' and 'sku' clearly documented. The description adds that the calculation is 'based on cost and selling price', but 'sellingPrice' is not a parameter in the schema, which might cause confusion. It provides minimal additional meaning beyond the schema, so the baseline score of 3 is appropriate given the high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'calculate' and the resource 'profit margin for a product or category', specifying it's based on cost and selling price. It distinguishes from siblings like 'calculate_discount' or 'calculate_labor_cost' by focusing on profit margin, though it doesn't explicitly contrast them. The purpose is specific but could be more distinct from similar tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'calculate_discount' or 'get_inventory_value'. It mentions the calculation is based on cost and selling price, but doesn't specify prerequisites, exclusions, or ideal contexts. Usage is implied from the purpose but lacks explicit direction.

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/wspotter/mcpart'

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