Skip to main content
Glama

Check whether a ranking engine ignores payout (static-imports only)

check_payout_invariance
Read-only

Scans supplied source files for payout-related identifiers to verify a ranking engine never references commission, payout, or affiliate data.

Instructions

Checks whether payout-related identifiers (commission, payout, affiliate rate) appear in the source of a ranking/recommendation engine. Only static-imports mode is available: running your ranking function under payout-mutation scenarios (runtime mode) is turned off because it runs caller-supplied JavaScript. The server operator can turn it on by setting HONESTY_MCP_ENABLE_CODE_EXEC=1; that runs the code with the server's full filesystem, network and environment access, and the worker thread only bounds time. static-imports mode greps source files you supply for any reference to payout-related identifiers, to assert the ranking engine's code never even has payout data in scope. You send the file contents as a map of path -> content; this server does not read paths from disk, and a list of paths is rejected. Matching is whole-word and case-insensitive: the identifier commission is NOT matched inside commissionRate, commission_rate, affiliateUrl or payoutPerClick, so those names do not match. Pass matchIdentifierParts: true to also find an identifier as one part of a longer camelCase, snake_case, SCREAMING_CASE or kebab-case name (it still does not match plurals such as affiliates, or a word fused into another with no separator, such as mypayout). It is a best-effort text/regex grep, not a real parser (it won't catch a dynamically-built import specifier or a re-export under an aliased name). An empty result means no match in the text you sent, not that the engine is payout-neutral in general; re-run this in CI whenever the ranking logic changes.

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": {
      "mode": "<mode>"
    },
    "name": "check_payout_invariance"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeYesWhich check to run. Only `static-imports` is available.
filesNo[static-imports mode, required, at least one file] Source files to scan for payout references, as a map of path -> content. A list of paths or an empty map is a tool error.
stripCommentsNo[static-imports mode] Strip comments before matching, so a mention in a comment doesn't count. Default true.
payoutIdentifiersNo[static-imports mode, required, non-empty] Identifiers that must never appear in the ranking engine's source, e.g. "commission", "payout", "affiliateRate". Each is matched as a whole word (`commission` does not match `commissionRate`; see `matchIdentifierParts`). An identifier that is blank (only whitespace or invisible characters) is a tool error.
caseInsensitiveMatchNo[static-imports mode] Case-insensitive identifier matching. Default true.
matchIdentifierPartsNo[static-imports mode, payout-invariance-kit 0.3+] Default false (whole-word matching, so `commission` does not match `commissionRate`). When true, an identifier is also found as one part of a longer camelCase, snake_case, SCREAMING_CASE or kebab-case name (`affiliate` finds `affiliateUrl` and `AFFILIATE_URL`), but not plurals or words fused with no separator.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv0.4.0
    • removedInput schema / properties / baseInput
      Removed value: -{
      -  "description": "[runtime mode, required] The baseline input to rankFn -- e.g. an array of candidate objects each carrying a payout/commission field."
      -}
    • changedInput schema / properties / files / anyOf
      Previous value: -[
      -  {
      -    "description": "File paths to read from disk (this server reads them locally).",
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "additionalProperties": {
      -      "type": "string"
      -    },
      -    "description": "Map of path -> file content. No filesystem access.",
      -    "propertyNames": {
      -      "type": "string"
      -    },
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "description": "Rejected with an error: this server does not read file paths from disk. Send a map instead.",
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "additionalProperties": {
      +      "type": "string"
      +    },
      +    "description": "Map of path -> file content. No filesystem access.",
      +    "propertyNames": {
      +      "type": "string"
      +    },
      +    "type": "object"
      +  }
      +]
    • changedInput schema / properties / files / description
      Previous value: -"[static-imports mode, required] Source files to scan for payout references."New value: +"[static-imports mode, required, at least one file] Source files to scan for payout references, as a map of path -> content. A list of paths or an empty map is a tool error."
    • addedInput schema / properties / matchIdentifierParts
      Added value: +{
      +  "description": "[static-imports mode, payout-invariance-kit 0.3+] Default false (whole-word matching, so `commission` does not match `commissionRate`). When true, an identifier is also found as one part of a longer camelCase, snake_case, SCREAMING_CASE or kebab-case name (`affiliate` finds `affiliateUrl` and `AFFILIATE_URL`), but not plurals or words fused with no separator.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / mode / description
      Previous value: -"Which check to run."New value: +"Which check to run. Only `static-imports` is available."
    • changedInput schema / properties / mode / enum
      Previous value: -[
      -  "runtime",
      -  "static-imports"
      -]New value: +[
      +  "static-imports"
      +]
    • removedInput schema / properties / mutations
      Removed value: -{
      -  "description": "[runtime mode, required, non-empty] Named adversarial payout-mutation scenarios.",
      -  "items": {
      -    "properties": {
      -      "mutateSource": {
      -        "description": "JS source for a pure function `(baseInput) => mutatedInput` that rewrites the payout/commission field(s) on a copy of baseInput. Adversarial cases matter more than easy ones -- e.g. 'every candidate gets an equal payout', 'the worst candidate gets the single highest payout'.",
      -        "minLength": 1,
      -        "type": "string"
      -      },
      -      "name": {
      -        "description": "Short, descriptive name for this mutation, shown in failure output.",
      -        "minLength": 1,
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "name",
      -      "mutateSource"
      -    ],
      -    "type": "object"
      -  },
      -  "type": "array"
      -}
    • changedInput schema / properties / payoutIdentifiers / description
      Previous value: -"[static-imports mode, required, non-empty] Identifiers that must never appear in the ranking engine's source, e.g. \"commission\", \"payout\", \"affiliateRate\"."New value: +"[static-imports mode, required, non-empty] Identifiers that must never appear in the ranking engine's source, e.g. \"commission\", \"payout\", \"affiliateRate\". Each is matched as a whole word (`commission` does not match `commissionRate`; see `matchIdentifierParts`). An identifier that is blank (only whitespace or invisible characters) is a tool error."
    • removedInput schema / properties / rankFnSource
      Removed value: -{
      -  "description": "[runtime mode, required] JS source for a pure ranking function `(input) => result`, e.g. \"(candidates) => candidates.slice().sort((a, b) => b.score - a.score)\". Built and run in a worker thread with a bounded timeout (default 10s, see README).",
      -  "type": "string"
      -}
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations declare readOnlyHint=true and openWorldHint=false, and the description is consistent while adding substantial context the annotations cannot convey: the runtime mode is disabled, the enabling env var HONESTY_MCP_ENABLE_CODE_EXEC=1 and its full filesystem/network/env exposure, that the worker thread only bounds time, and that this tool never reads paths from disk. It also discloses the best-effort nature of the grep and what an empty result does and does not prove.

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?

Purpose and mode availability are front-loaded in the first two sentences, and the caveats follow in a logical order. Some matching rules are restated in both the description and the schema (whole-word, case-insensitive, matchIdentifierParts), which costs a little length, but no sentence is filler.

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?

For a six-parameter read-only checker with no output schema, the description covers input format (map of path -> content, lists rejected), mode limits, matching behavior, and the meaning of an empty result. The remaining gap is the shape of a non-empty result (fields, file/line reporting), which an agent must discover by calling it.

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

Parameters4/5

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

Schema coverage is already 100%, but the description goes beyond it with concrete matching semantics: `commission` does not match `commissionRate`, `commission_rate`, `affiliateUrl` or `payoutPerClick`, and `matchIdentifierParts: true` extends to camelCase/snake_case/SCREAMING_CASE/kebab-case while still excluding plurals and fused words like `mypayout`. That is real added meaning over the schema's shorter prose.

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 opens with a specific verb and resource: it checks whether payout-related identifiers (commission, payout, affiliate rate) appear in the source of a ranking/recommendation engine. The title's '(static-imports only)' is elaborated in the body, so an agent knows exactly which capability it is selecting among the sibling check_* tools.

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

Usage Guidelines4/5

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

It states the intent (assert the ranking engine never has payout data in scope) and gives an operational trigger: 're-run this in CI whenever the ranking logic changes.' It also rules out the runtime alternative by explaining it is disabled. What it lacks is an explicit contrast with any named sibling tool, so the agent must infer routing from purpose alone.

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