Skip to main content
Glama

Samuelz® Sales

Vorhandenen Kostenbeleg intern zuordnen

allocate_sales_cost
Idempotent

Choose this only to record or correct an explicit internal attribution, after get_sales_cost_sources and get_sales_costs. Reading originals or existing allocations needs neither this write nor a new consent. Record an explicitly requested internal supplier-invoice cost attribution to one learning opportunity or channel.

Read first: get_sales_cost_sources supplies the original document fingerprint and available net; read the current target and, for corrections, get_sales_costs. Copy the returned identities and revisions.

Allocate: choose a positive netAmountMinor share, its category, actual expense date and rationale. All active shares of the original invoice together must stay within its net amount.

Channel comparison: only when explicitly requested, copy group.costComparisonScope from get_sales_measurement as comparisonScope={scope,confirmed:true}. It identifies the exact first-recorded period, segment/offer/channel versions and currency. Omission preserves a binding; {scope:null,confirmed:true} removes it. No automatic spreading of channel expense.

Correct or release: retain allocationId and original document, copy expectedRevision. source=null with amount=0 releases and preserves historical comparison context. Reuse requestKey and exact inputs on retry.

Returns status, allocationId, new revision, target and active state; externalEffect=false. Current CRM read/write, Operations/Accounting read consent and owner authority are checked at insert. Attribution only: invoicing, payments and commercial commitments remain in their original workflows. No tenant selector.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "allocationId": "<allocationId>",
      "expectedRevision": "<expectedRevision>",
      "target": "<target>",
      "source": "<source>",
      "netAmountMinor": "<netAmountMinor>",
      "category": "<category>",
      "incurredOn": "<incurredOn>",
      "reason": "<reason>",
      "requestKey": "<requestKey>"
    },
    "name": "allocate_sales_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
reasonYesHuman rationale for this attribution, correction or release.
sourceYesCopy documentId and current fingerprint from get_sales_cost_sources; null releases an existing allocation.
targetYesCurrent same-tenant learning opportunity or channel: copy id, kind and current revision.
categoryYesPurpose of this documented expense share, not an instruction to spend.
incurredOnYesActual expense date (YYYY-MM-DD), never future; independent of the opportunity comparison period.
requestKeyYesNew UUID per distinct revision. Reuse exactly this key and all inputs when retrying.
allocationIdYesStable allocation UUID; create once and retain for corrections or release.
netAmountMinorYesPositive integer share in the source invoice currency's minor units; exactly 0 for release. All active shares together must fit the original net amount.
comparisonScopeNoChannel costs only: copy group.costComparisonScope from get_sales_measurement and explicitly confirm. Omission preserves a binding; scope=null explicitly removes it. Do not supply on release.
expectedRevisionYes0 for a new allocation; otherwise copy its current revision from get_sales_costs.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / comparisonScope / properties / confirmed / description
      Added value: +"Exactly true for the user-confirmed comparison binding/removal; does not approve a payment, invoice or send."
    • changedInput schema / properties / comparisonScope / properties / scope / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "basis": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "channel": {
      -            "additionalProperties": false,
      -            "properties": {
      -              "id": {
      -                "pattern": "^[a-zA-Z0-9_-]{1,100}$",
      -                "type": "string"
      -              },
      -              "revision": {
      -                "exclusiveMinimum": 0,
      -                "maximum": 9007199254740991,
      -                "type": "integer"
      -              },
      -              "title": {
      -                "maxLength": 200,
      -                "minLength": 1,
      -                "type": "string"
      -              }
      -            },
      -            "required": [
      -              "id",
      -              "revision",
      -              "title"
      -            ],
      -            "type": "object"
      -          },
      -          "currency": {
      -            "pattern": "^[A-Z]{3}$",
      -            "type": "string"
      -          },
      -          "offer": {
      -            "additionalProperties": false,
      -            "properties": {
      -              "id": {
      -                "pattern": "^[a-zA-Z0-9_-]{1,100}$",
      -                "type": "string"
      -              },
      -              "revision": {
      -                "exclusiveMinimum": 0,
      -                "maximum": 9007199254740991,
      -                "type": "integer"
      -              },
      -              "title": {
      -                "maxLength": 200,
      -                "minLength": 1,
      -                "type": "string"
      -              }
      -            },
      -            "required": [
      -              "id",
      -              "revision",
      -              "title"
      -            ],
      -            "type": "object"
      -          },
      -          "segment": {
      -            "additionalProperties": false,
      -            "properties": {
      -              "id": {
      -                "pattern": "^[a-zA-Z0-9_-]{1,100}$",
      -                "type": "string"
      -              },
      -              "revision": {
      -                "exclusiveMinimum": 0,
      -                "maximum": 9007199254740991,
      -                "type": "integer"
      -              },
      -              "title": {
      -                "maxLength": 200,
      -                "minLength": 1,
      -                "type": "string"
      -              }
      -            },
      -            "required": [
      -              "id",
      -              "revision",
      -              "title"
      -            ],
      -            "type": "object"
      -          }
      -        },
      -        "required": [
      -          "segment",
      -          "offer",
      -          "channel",
      -          "currency"
      -        ],
      -        "type": "object"
      -      },
      -      "endsAt": {
      -        "format": "date-time",
      -        "maxLength": 100,
      -        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
      -        "type": "string"
      -      },
      -      "startsAt": {
      -        "format": "date-time",
      -        "maxLength": 100,
      -        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
      -        "type": "string"
      -      },
      -      "version": {
      -        "const": "sales_cost_cohort.v1",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "version",
      -      "startsAt",
      -      "endsAt",
      -      "basis"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "basis": {
      +        "additionalProperties": false,
      +        "description": "Frozen segment/offer/channel record identities and revisions plus currency from one native comparison population.",
      +        "properties": {
      +          "channel": {
      +            "additionalProperties": false,
      +            "description": "Exact current acquisition-channel record in the selected comparison basis.",
      +            "properties": {
      +              "id": {
      +                "description": "Exact existing segment, offer or channel ID from the selected native measurement basis; never a free-text label.",
      +                "pattern": "^[a-zA-Z0-9_-]{1,100}$",
      +                "type": "string"
      +              },
      +              "revision": {
      +                "description": "Current positive revision of that same selected basis record, copied unchanged; a stale basis requires reread.",
      +                "exclusiveMinimum": 0,
      +                "maximum": 9007199254740991,
      +                "type": "integer"
      +              },
      +              "title": {
      +                "description": "Title from that same basis record/revision, copied with its ID; not a new record name.",
      +                "maxLength": 200,
      +                "minLength": 1,
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "revision",
      +              "title"
      +            ],
      +            "type": "object"
      +          },
      +          "currency": {
      +            "description": "Three-letter uppercase currency of that exact comparison basis; do not convert or mix currencies.",
      +            "pattern": "^[A-Z]{3}$",
      +            "type": "string"
      +          },
      +          "offer": {
      +            "additionalProperties": false,
      +            "description": "Exact current offer record in the selected comparison basis; not an issued customer payment offer.",
      +            "properties": {
      +              "id": {
      +                "description": "Exact existing segment, offer or channel ID from the selected native measurement basis; never a free-text label.",
      +                "pattern": "^[a-zA-Z0-9_-]{1,100}$",
      +                "type": "string"
      +              },
      +              "revision": {
      +                "description": "Current positive revision of that same selected basis record, copied unchanged; a stale basis requires reread.",
      +                "exclusiveMinimum": 0,
      +                "maximum": 9007199254740991,
      +                "type": "integer"
      +              },
      +              "title": {
      +                "description": "Title from that same basis record/revision, copied with its ID; not a new record name.",
      +                "maxLength": 200,
      +                "minLength": 1,
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "revision",
      +              "title"
      +            ],
      +            "type": "object"
      +          },
      +          "segment": {
      +            "additionalProperties": false,
      +            "description": "Exact current segment record in the selected comparison basis.",
      +            "properties": {
      +              "id": {
      +                "description": "Exact existing segment, offer or channel ID from the selected native measurement basis; never a free-text label.",
      +                "pattern": "^[a-zA-Z0-9_-]{1,100}$",
      +                "type": "string"
      +              },
      +              "revision": {
      +                "description": "Current positive revision of that same selected basis record, copied unchanged; a stale basis requires reread.",
      +                "exclusiveMinimum": 0,
      +                "maximum": 9007199254740991,
      +                "type": "integer"
      +              },
      +              "title": {
      +                "description": "Title from that same basis record/revision, copied with its ID; not a new record name.",
      +                "maxLength": 200,
      +                "minLength": 1,
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "revision",
      +              "title"
      +            ],
      +            "type": "object"
      +          }
      +        },
      +        "required": [
      +          "segment",
      +          "offer",
      +          "channel",
      +          "currency"
      +        ],
      +        "type": "object"
      +      },
      +      "endsAt": {
      +        "description": "Exclusive end of the same comparison population, after startsAt and at most 366 days later; not a payment forecast horizon.",
      +        "format": "date-time",
      +        "maxLength": 100,
      +        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
      +        "type": "string"
      +      },
      +      "startsAt": {
      +        "description": "Inclusive start of the selected comparison population as an offset-aware ISO timestamp; normalized to UTC.",
      +        "format": "date-time",
      +        "maxLength": 100,
      +        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
      +        "type": "string"
      +      },
      +      "version": {
      +        "const": "sales_cost_cohort.v1",
      +        "description": "Exact existing cost-cohort contract version; not a mutable record revision.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "version",
      +      "startsAt",
      +      "endsAt",
      +      "basis"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / comparisonScope / properties / scope / description
      Added value: +"Exact comparison population to bind, or explicit null to remove the existing comparison binding. Omit the parent comparisonScope field to preserve it."
  2. Changed4 schema fields changed
    • changedInput schema / properties / source / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "documentId": {
      -        "maxLength": 200,
      -        "minLength": 1,
      -        "type": "string"
      -      },
      -      "fingerprint": {
      -        "pattern": "^[a-f0-9]{64}$",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "documentId",
      -      "fingerprint"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "documentId": {
      +        "description": "Exact supplier-invoice documentId from get_sales_cost_sources.",
      +        "maxLength": 200,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "fingerprint": {
      +        "description": "Exact current source fingerprint returned by get_sales_cost_sources; preserve it with the same documentId.",
      +        "pattern": "^[a-f0-9]{64}$",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "documentId",
      +      "fingerprint"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / target / properties / id / description
      Added value: +"Exact existing learning opportunity or channel ID matching kind; not a customer, invoice or allocation ID."
    • addedInput schema / properties / target / properties / kind / description
      Added value: +"Existing attribution target type, opportunity or channel. Keep kind, id and current revision from the same target."
    • addedInput schema / properties / target / properties / revision / description
      Added value: +"Current revision of that exact target; a changed target requires reread before attribution."
  3. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the supplied annotations (readOnly=false, destructive=false, idempotent=true, openWorld=false) it discloses that consent and owner authority are checked at insert, that externalEffect=false, that invoicing/payments stay in other workflows, that release is done via source=null with amount=0 while preserving comparison history, and that a retry must reuse requestKey with identical inputs. That is material behavioral context the annotations cannot carry.

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?

It is front-loaded with the eligibility rule and then chunked under labels (Read first, Allocate, Channel comparison, Correct or release, Returns), which makes a dense 10-parameter tool scannable. It is verbose and some constraint restatement (revision/fingerprint copying) recurs, but nearly every sentence carries an operational rule.

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

Completeness5/5

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

For a 10-parameter, deeply nested mutation with no output schema, the description still covers the read-then-write sequence, the release path, idempotent retry, and an explicit list of return values (status, allocationId, revision, target, active state, externalEffect=false). Nothing needed to call it correctly appears to be missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100%, the description adds cross-parameter semantics the schema cannot express: omission of comparisonScope preserves a binding while {scope:null,confirmed:true} removes it, expectedRevision=0 means a new allocation, release requires source=null together with amount=0, and the sum of active shares must stay within the original net. These interaction rules materially improve correct invocation.

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 gives a specific verb and resource: record or correct an explicit internal attribution of a supplier-invoice cost share to one learning opportunity or channel. It also explicitly separates this write from the read siblings (get_sales_cost_sources, get_sales_costs), so an agent can tell it apart from every adjacent tool.

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

Usage Guidelines5/5

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

It leads with a hard gate ('Choose this only to record or correct an explicit internal attribution'), states the required precondition that the two read tools must run first, and explicitly rules out the read path ('Reading originals or existing allocations needs neither this write nor a new consent'). It also scopes channel comparison to explicit user request only.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources