Skip to main content
Glama
presidio-hardened-x402-mcp

presidio-hardened-x402-mcp

by presidio-v

check_payment_policy

Verifies a payment against configured spending limits and records the spend before submission. Call once immediately before paying to avoid inflating rolling spend windows.

Instructions

Check whether a payment is allowed by the configured spending policy.

WARNING: this records the spend against rolling time-window ledgers. Call exactly once, immediately before submitting the payment. If you call this and then do not pay, the spend window will be inflated until it rolls over.

Configure limits at server startup via PRESIDIO_X402_MCP_* env vars.

Args: resource_url: x402 resource URL being paid. Screened first; only the redacted URL reaches the policy engine (per-endpoint limits match on it, so keep PII out of configured endpoint prefixes). amount_usd: Payment amount in USD-equivalent. prior_decision_refs: Optional decision_ref values this server returned earlier for the same payment (e.g. from screen_payment_metadata); linked into the signed record. Max 8.

Returns: {"allowed": true} on success, or {"allowed": false, "reason": str, "limit_usd": float, "amount_usd": float}; plus decision_ref when signed decision evidence is enabled.

Input Schema

NameRequiredDescriptionDefault
amount_usdYes
resource_urlYes
prior_decision_refsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.0
    • addedInput schema / properties / prior_decision_refs
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Prior Decision Refs"
      +}
  2. First observedv0.1.2

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it discloses that the call mutates rolling spend ledgers, warns about window inflation if no payment follows, explains the URL redaction/screening behavior, and states configuration via env vars and optional signed decision evidence.

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 warning and the core rule are front-loaded, and the Args/Returns structure is easy to scan. It is somewhat long, but nearly every line conveys operationally relevant behavior for a side-effecting tool.

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?

Given no annotations, a 3-parameter mutation-style check, and an output schema, the description covers the critical side effect, safe-call timing, parameter meanings, and return shapes. Nothing essential for correct invocation is 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?

Schema description coverage is 0%, but the description supplies meaning for every parameter: resource_url is screened and redacted before policy matching, amount_usd is USD-equivalent, and prior_decision_refs are optional decision_ref values from earlier server responses, capped at 8.

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 description states a specific verb and object: checking whether a payment is allowed by the configured spending policy. It is clearly a policy-evaluation tool, though it does not explicitly distinguish itself from the sibling check_payment_replay beyond the shared payment-checking context.

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 gives an explicit operational rule: call exactly once, immediately before submitting the payment, and warns what happens if the payment is not then made. It also points to screen_payment_metadata as the source of prior_decision_refs, so the agent knows where that input comes from.

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