Skip to main content
Glama

Margin Scoring

ps_margin_scoring

Calculate gross margin per product using price and wholesale price, classify margins as excellent, good, low, or critical, mark missing cost data as no_data, and save results to a dated JSON file.

Instructions

Calculate gross margin per product using the wholesale_price field.

margin % = (price - wholesale_price) / price × 100 Classification: "excellent" (>50%), "good" (30–50%), "low" (15–30%), "critical" (<15%) Products without wholesale_price are marked as "no_data".

Saves to /data/margin_scores_YYYY-MM-DD.json.

Args:

  • lang_id: Language ID for product names (default: "1")

  • limit: Max products to analyse (default: 200)

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "ps_margin_scoring"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMax products to analyse
lang_idNoLanguage ID for product names1

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, destructiveHint=false, and idempotentHint=false, so the tool is known to write but not destroy. The description adds real context beyond that: it discloses the exact output path '/data/margin_scores_YYYY-MM-DD.json', the computation formula, the bucket thresholds, and the handling of products lacking wholesale_price. It does not say whether a same-day rerun overwrites the existing file, which is the one behavioral detail missing.

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 core is front-loaded: purpose, formula, classification scale, edge case, and output destination, each earning its place. The trailing 'Args' block largely duplicates schema content and is the only real source of redundancy. Formatting with a formula and a threshold list makes it scannable.

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

Completeness4/5

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

With no output schema, the description does the work of explaining what is produced: a date-stamped JSON file at a named path with a classification per product. It leaves open whether the tool also returns the payload inline or only writes the file, which is a minor but real gap for an agent deciding what to do with the result.

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 description coverage is 100%, so both 'lang_id' and 'limit' are already documented, including the maximum of 500 and default of 200. The description's 'Args' block restates those defaults and adds only the mild clarification that lang_id affects product names, which is close to what the schema already conveys. Baseline 3 is appropriate.

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 first sentence names a specific verb and resource: 'Calculate gross margin per product using the wholesale_price field.' The formula and the four classification buckets make the output shape unambiguous. It does not explicitly contrast itself with any sibling, so it falls just short of a 5.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: the tool is clearly for margin analysis on catalog products, and the 'no_data' rule hints at sparse wholesale_price data, which is useful context. It never says when to pick this over a reporting sibling like ps_generate_full_report or ps_category_performance, nor does it state prerequisites such as products needing a price field.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools