MarginFront MCP Tools Reference
This is a complete list of the core MarginFront MCP tools. There are 25 tools total, organized into groups: read-only, write, diagnostic, destructive, canonical analytics, and pricing setup. Your AI assistant calls these tools automatically when you ask it questions about your MarginFront data. You don’t need to memorize tool names. Just ask in plain English and the AI picks the right tool. Detailed parameters and examples for every tool live in the machine-readable llms-mcp.txt, which is the canonical source the MCP server and AI clients both read.Read-Only Tools (8)
These tools look things up without changing anything.1. verify
What it does: Checks that your API key is valid and shows which organization it belongs to. This is the “hello world” of MCP — call it first to make sure everything is wired up. Parameters: None. What it returns: Your organization name and a verified status. Example prompt: “Verify my MarginFront connection”2. list_customers
What it does: Lists your customers with optional search and pagination. Good for browsing your customer list or finding a specific customer by name. Parameters:| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| page | number | No | 1 | Which page of results to show |
| limit | number | No | 20 | How many results per page (1-100) |
| search | string | No | — | Search by customer name or external ID |
3. get_customer
What it does: Gets detailed information about one specific customer, including their subscriptions. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| customerId | string | Yes | The customer’s MarginFront UUID (not their external ID) |
Note: This tool needs the MarginFront UUID, not the external ID you use in your own system. Use list_customers first to find the UUID.
4. list_invoices
What it does: Lists invoices with optional filters by status or customer. Parameters:| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| status | string | No | — | Filter by status: "draft", "pending", "paid", "overdue", or "void" |
| customerId | string | No | — | Filter by customer UUID |
| page | number | No | 1 | Which page of results |
| limit | number | No | 20 | Results per page (1-100) |
5. get_invoice
What it does: Gets full details about one invoice, including every line item and payment history. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| invoiceId | string | Yes | The invoice’s UUID |
6. list_events
What it does: Lists usage events (the raw records of what your customers actually used) with optional filters. Parameters:| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| page | number | No | 1 | Which page of results |
| limit | number | No | 20 | Results per page (1-100) |
| customerExternalId | string | No | — | Filter by customer external ID (the ID in your own system, e.g. "acme-001"). NOT the MarginFront UUID. |
| agentId | string | No | — | Filter by agent UUID |
| signalId | string | No | — | Filter by signal UUID |
| startDate | string | No | — | Only show events after this date (ISO 8601 format, e.g. "2026-04-01") |
| endDate | string | No | — | Only show events before this date (ISO 8601 format) |
7. get_usage_analytics
What it does: Gets aggregated usage analytics (totals and trends) for a date range. Unlikelist_events which shows individual events, this gives you the big picture — totals, breakdowns, and time-series data.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| startDate | string | Yes | — | Start of the date range (ISO 8601, e.g. "2026-04-01") |
| endDate | string | Yes | — | End of the date range (ISO 8601, e.g. "2026-04-12") |
| groupBy | string | No | — | How to break down the data: "agent", "customer", "signal", "model", or "day" |
8. list_subscriptions
What it does: Lists customer subscriptions (which customer is on which pricing plan). Parameters:| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| status | string | No | — | Filter by status: "active", "canceled", "past_due", "trialing" |
| customerId | string | No | — | Filter by customer UUID |
| page | number | No | 1 | Which page of results |
| limit | number | No | 20 | Results per page (1-100) |
Write Tools (3)
These tools create or modify data. They change things in MarginFront, so the AI will usually confirm before calling them.9. record_usage
What it does: Records a single usage event — one measurement of a customer using your AI agent. This is how MarginFront learns what to bill for. There are two kinds of events:- LLM events (chatbots, summarizers, etc.): pass
inputTokensandoutputTokens. - Non-LLM events (SMS, web scraping, API calls, etc.): pass
quantityinstead.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| customerExternalId | string | Yes | — | Your customer’s ID in your system, e.g. "acme-001" |
| agentCode | string | Yes | — | The agent/product code from your dashboard, e.g. "cs-bot-v2" |
| signalName | string | Yes | — | The metric being tracked, e.g. "messages" or "pages_processed" |
| model | string | Yes | — | The model identifier, e.g. "gpt-4o", "claude-sonnet-4-6", "twilio-sms" |
| modelProvider | string | Yes | — | The provider name in lowercase, e.g. "openai", "anthropic", "twilio" |
| inputTokens | number | No | — | Number of input/prompt tokens (for LLM events) |
| outputTokens | number | No | — | Number of output/completion tokens (for LLM events) |
| quantity | number | No | 1 | Number of billing units (for non-LLM events) |
| usageDate | string | No | now | ISO 8601 date for backdating, e.g. "2026-04-01T00:00:00Z" |
| metadata | object | No | — | Custom key-value pairs stored with the event (not used for billing) |
get_needs_attention and map_model to fix it.
Example prompt: “Record a usage event: customer acme-001 used cs-bot, signal messages, gpt-4o from openai, 500 input tokens, 120 output tokens”
Important: If you get a “NEEDS_COST_BACKFILL” response, do NOT re-send the event. The event was saved. The model just isn’t in the pricing table yet. Useget_needs_attentionto see which models need mapping, thenmap_modelto fix them.
10. record_usage_batch
What it does: Records multiple usage events at once (1 to 100 per request). Each record has the same fields asrecord_usage. You can mix LLM events and non-LLM events in the same batch.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
| records | array | Yes | An array of 1-100 usage records. Each record has the same fields as record_usage (see above). |
11. create_customer
What it does: Creates a new customer in MarginFront. Parameters:| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | — | Customer’s display name, e.g. "Acme Corp" |
| externalId | string | No | — | Your system’s ID for this customer, e.g. "acme-001" |
| string | No | — | Customer’s email address | |
| phone | string | No | — | Customer’s phone number |
Tip: Always set externalId when creating a customer. That’s the ID you’ll use when recording usage events later, so it should match whatever ID you use for this customer in your own system.
Diagnostic Tool (1)
This tool helps you find and fix data issues.12. get_needs_attention
What it does: Finds usage events where the model+provider combination isn’t in the pricing table. These events were saved (the data isn’t lost), but their cost is null because MarginFront doesn’t know how much that model costs. Parameters:| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| startDate | string | No | 30 days ago | Only look at events after this date (ISO 8601) |
| endDate | string | No | now | Only look at events before this date (ISO 8601) |
Important: These events ARE saved — they just have cost=null. Do NOT re-send them. Use map_model (below) to tell MarginFront what pricing to use, and it will backfill the costs automatically.
Destructive Tool (1)
This tool modifies existing data. “Destructive” sounds scary, but it’s actually a fix-it tool — and it’s safe to run more than once (it’s idempotent, meaning running it twice produces the same result as running it once).13. map_model
What it does: Maps an unknown model to a known one in the pricing table, then backfills costs for all affected events. This creates a permanent, organization-scoped mapping — once you map it, future events with the same model+provider will have their costs calculated automatically. You tell it the “source” (the unknown model) and the “target” (the known model to price it as). You can identify the target two ways:- By name: pass
targetModel+targetProvider(e.g., map “gpt-4o-2024-08-06” to “gpt-4o” from “openai”). - By ID: pass
targetPricingId(the UUID of the specific pricing table row).
| Name | Type | Required | Description |
|---|---|---|---|
| sourceModel | string | Yes | The unknown model name to map FROM, e.g. "gpt-4o-2024-08-06" |
| sourceProvider | string | Yes | The unknown provider to map FROM, e.g. "openai" |
| targetPricingId | string | No* | UUID of the target pricing row to map TO |
| targetModel | string | No* | Known model name to map TO, e.g. "gpt-4o" |
| targetProvider | string | No* | Known provider to map TO, e.g. "openai" |
*You must provide eitherWhat it returns: Confirmation of the mapping, how many events had their costs backfilled, and the mapping ID. Example prompt: “Map model gpt-4o-2024-08-06 from openai to gpt-4o from openai”targetPricingIdOR bothtargetModel+targetProvider. One or the other, not both.
Safe to run again: If you accidentally run this twice with the same inputs, nothing bad happens. It’s idempotent.
Diagnostic Tools (2)
14. get_missing_volume
What it does: Lists usage events that landed in theMISSING_VOLUME_DATA state. events where the agent didn’t send tokens (for LLM calls) or quantity (for non-LLM). The platform stored them anyway, waiting for the volume data to arrive.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
| startDate | string | No | Only include events with usageDate after this (ISO 8601) |
| endDate | string | No | Only include events with usageDate before this (ISO 8601) |
fill_volume.
Example prompt: “Show me any LLM events still missing tokens” or “Which events landed without quantity this month?“
15. fill_volume
What it does: Supplies the missing volume data for aMISSING_VOLUME_DATA event. Once filled, the platform recalculates usageCost and flips the event to PROCESSED.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
| eventId | string | Yes | UUID of the incomplete event |
| inputTokens | number | No | LLM input tokens (for LLM events missing this) |
| outputTokens | number | No | LLM output tokens (for LLM events missing this) |
| quantity | number | No | Non-LLM quantity (for non-LLM events missing this) |
usageCost, and its new PROCESSED state.
Example prompt: “Fill in 1500 input and 400 output tokens for event abc-123”
Safe to run again: If the event is already PROCESSED, running fill_volume on it returns the existing state without re-computing.
Canonical Analytics Tools (3)
These tools expose MarginFront’s single source of truth for revenue, cost, and MRR. They return the same numbers the dashboard KPI tiles display.16. get_customer_revenue
What it does: Returns revenue, cost, and margin for a single customer over a date range. Use this when an AI agent needs to answer “how much has this customer paid us?” or “what’s our margin on this account?” without loading the full analytics view. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| customerId | string | Yes | Customer UUID (not the external ID. use the MarginFront internal ID) |
| startDate | string | Yes | Window start (ISO 8601) |
| endDate | string | Yes | Window end (ISO 8601) |
17. get_cost_metrics
What it does: Returns the full cost breakdown across the organization (or filtered to a single customer / agent). Includes per-day, per-agent, per-customer, per-signal, per-plan, per-model splits. Optional prior-window trend comparison. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| startDate | string | Yes | Window start (ISO 8601) |
| endDate | string | Yes | Window end (ISO 8601) |
| customerId | string | No | Filter to a single customer UUID |
| agentId | string | No | Filter to a single agent UUID |
| includePriorWindow | boolean | No | Compute prior-period cost + trend delta for the same window length |
byAgent, byCustomer, bySignal, byDay, byPlan, byModel). When includePriorWindow is true, also returns prior with the same shape for the preceding equivalent period.
Example prompt: “Break down our AI costs by model for last month” or “Show cost trend for Deal Ops agent week over week.”
18. get_mrr
What it does: Returns Monthly Recurring Revenue using one of three canonical variants. MarginFront tracks three distinct MRR computations because “what’s our MRR?” has three different right answers depending on what question you’re asking. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| variant | string | No | One of: canonical (default; last completed month invoice total), runRate (last 30 days of activity projected forward), committed (contractual floor only) |
| customerId | string | No | Filter to a single customer UUID |
| subscriptionId | string | No | Filter to a single subscription UUID |
canonical) or “What’s our run-rate MRR if usage keeps trending?” (runRate) or “What’s our committed MRR floor for forecasting?” (committed).
Pricing Setup Tools (7)
19. create_pricing_plan
What it does: Creates a new pricing plan for an agent. A pricing plan is a container for pricing strategies (which are the per-signal billing rules). Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Display name, e.g. "Growth Plan" |
| description | string | No | Human-readable description of what the plan covers |
| agentId | string | No | UUID of the agent this plan is scoped to (leave empty for org-wide) |
20. list_pricing_plans
What it does: Lists all pricing plans for the organization, with optional filtering by agent. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| agentId | string | No | Filter to plans scoped to a specific agent UUID |
21. get_pricing_plan
What it does: Returns full details on a single pricing plan, including all its pricing strategies and their rates. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| planId | string | Yes | Plan UUID to retrieve |
22. create_pricing_strategy
What it does: Creates a pricing strategy on an existing plan. A strategy is the per-signal rule: “for this metric, charge this way.” Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| planId | string | Yes | Parent plan UUID |
| signalId | string | Yes | Signal (metric) UUID this strategy applies to |
| chargeType | string | Yes | One of: usage, recurring, seat_based, onetime |
| pricingModel | string | Yes | One of: flat, tiered, volume, credit_pool (only applies to usage) |
| rate | number | Yes | Per-unit rate in dollars (for flat + recurring + seat_based + onetime) |
| tiers | array | No | Tier config for tiered/volume (array of {upTo, rate} objects) |
| minimumCommitment | number | No | Minimum number of units/seats committed (floor) |
23. list_pricing_strategies
What it does: Lists all pricing strategies on a plan. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| planId | string | Yes | Plan UUID to list strategies for |
24. link_plan_to_agent
What it does: Attaches an existing pricing plan to an agent. An agent can be attached to multiple plans (each pricing different customer tiers). Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| planId | string | Yes | Plan UUID to attach |
| agentId | string | Yes | Agent UUID to attach to |
25. create_subscription
What it does: Creates a subscription tying a customer to an agent + plan. Once created, events fired for this (customer, agent, signal) combination bill against this subscription’s pricing strategies. Parameters:| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Display name (e.g. "Acme Corp: Growth Plan") |
| customerId | string | Yes | Customer UUID |
| agentId | string | Yes | Agent UUID |
| planId | string | Yes | Pricing plan UUID |
| billingCycle | string | Yes | One of: monthly, yearly |
| billingModel | string | Yes | One of: usage, recurring, seat_based, hybrid |
| startDate | string | No | When the subscription becomes active (defaults to now) |

