Skip to main content
Glama

rms_daily_sales

Retrieve daily sales summary including orders, revenue, tax, coupons, and delivery charges for a specified date range.

Instructions

Daily sales summary (orders, revenue, tax, coupons, delivery)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateNoYYYY-MM-DD
end_dateNoYYYY-MM-DD

Implementation Reference

  • The _daily_sales() function is the actual handler for the rms_daily_sales tool. It processes arguments (start_date, end_date), fetches orders via _fetch_all_orders, aggregates daily stats (order count, revenue, tax, shop coupon, delivery), and returns a formatted markdown table.
    async def _daily_sales(args: dict, api: OrderAPI) -> list[TextContent]:
        now = _now()
        start = datetime.fromisoformat(args.get("start_date", (now - timedelta(days=7)).strftime("%Y-%m-%d")))
        end = datetime.fromisoformat(args.get("end_date", now.strftime("%Y-%m-%d")))
        end = end.replace(hour=23, minute=59, second=59)
    
        orders = _fetch_all_orders(api, start, end, ACTIVE_PROGRESS)
        if not orders:
            return [TextContent(type="text", text="No orders found.")]
    
        daily: dict[str, dict] = defaultdict(lambda: {"o": 0, "rev": 0, "tax": 0, "cs": 0, "co": 0, "dlv": 0})
        for o in orders:
            d = o.get("orderDatetime", "")[:10]
            daily[d]["o"] += 1
            daily[d]["rev"] += o.get("totalPrice", 0)
            daily[d]["tax"] += o.get("goodsTax", 0)
            daily[d]["cs"] += o.get("couponShopPrice", 0)
            daily[d]["co"] += o.get("couponOtherPrice", 0)
            daily[d]["dlv"] += o.get("deliveryPrice", 0)
    
        lines = [f"# RMS Daily Sales: {start.date()} ~ {end.date()}\n| Date | Orders | Revenue | Tax | Shop Coupon | Delivery |\n|---|---|---|---|---|---|"]
        gt, go = 0, 0
        for day in sorted(daily):
            d = daily[day]
            gt += d["rev"]; go += d["o"]
            lines.append(f"| {day} | {d['o']}件 | ¥{d['rev']:,} | ¥{d['tax']:,} | ¥{d['cs']:,} | ¥{d['dlv']:,} |")
        avg = gt // go if go else 0
        lines.append(f"\n**Total**: {go} orders, ¥{gt:,}, avg ¥{avg:,}")
        return [TextContent(type="text", text="\n".join(lines))]
  • The Tool registration with inputSchema defines the rms_daily_sales tool: description='Daily sales summary (orders, revenue, tax, coupons, delivery)', with optional string parameters 'start_date' and 'end_date' (YYYY-MM-DD format).
    Tool(name="rms_daily_sales", description="Daily sales summary (orders, revenue, tax, coupons, delivery)",
         inputSchema={"type": "object", "properties": {
             "start_date": {"type": "string", "description": "YYYY-MM-DD"},
             "end_date": {"type": "string", "description": "YYYY-MM-DD"},
         }}),
  • The call_tool() function dispatches 'rms_daily_sales' to the _daily_sales() handler.
    if name == "rms_daily_sales":
        return await _daily_sales(arguments, api)
  • _fetch_all_orders() is a helper used by _daily_sales to retrieve all orders within a date range and status progress list.
    def _fetch_all_orders(api: OrderAPI, start: datetime, end: datetime, progress: list[int] | None) -> list[dict]:
        r = api.search_orders(_to_rms(start), _to_rms(end), date_type=1, progress_list=progress)
        nums = r.get("orderNumberList", [])
        if not nums:
            return []
        orders = []
        for i in range(0, len(nums), 50):
            detail = api.get_order(nums[i : i + 50])
            orders.extend(detail.get("OrderModelList", []))
        return orders
Behavior2/5

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

No annotations are provided, so the description must fully convey behavioral traits. It mentions the data fields but does not disclose whether the summary is per day or over the range, any read-only nature, or other side effects.

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 line listing the included metrics. No unnecessary words, but could potentially add structured detail without becoming verbose.

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 no output schema, the description should cover return structure. It only lists components but does not specify aggregation level, format, or pagination, leaving significant gaps for a summary tool.

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 coverage is 100% with parameter descriptions for start_date and end_date. The description adds no extra semantics beyond the schema, meeting the baseline for a 2-param tool.

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

Purpose5/5

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

The description clearly states the tool provides a 'daily sales summary' and enumerates specific components (orders, revenue, tax, coupons, delivery). This differentiates it from siblings like rms_cancel_rate or rms_order_detail.

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?

The description implies use for aggregated daily sales metrics but lacks explicit when-to-use or when-not instructions. No alternatives are mentioned, leaving the agent to infer context from sibling names.

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/yasuhidekoizumi-afk/rms-mcp'

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