Skip to main content
Glama

Payment Guard

payment_guard_authorize
Idempotent

Payment Guard: enforce your own spend rules before an agent pays. Set rules once per API key (or an account default): max_per_call_usd, daily_budget_usd, period_budget_usd + period_hours, allowed_sellers, allowed_domains, max_calls_per_minute, max_calls_per_hour. Then send each payment intent to POST /v1/payment-guard/authorize: allow returns a short-lived Ed25519-signed clearance (not a payment signature) and reserves the amount against your budgets atomically; block returns HTTP 403 with reasons and nothing is reserved. POST /v1/payment-guard/proxy does the same check and, on allow, forwards your client-signed PAYMENT-SIGNATURE (or X-PAYMENT) to the seller once per event_id. Non-custodial: Screwtape.ai never holds funds and never accepts private keys, seeds or mnemonics. Requires a Bearer API key. authorize and proxy use one shared free-tier or prepaid call each ($0.005 equivalent); rules endpoints are free. Same event_id + body replays the decision without billing again. Over MCP, send the Bearer API key as the Authorization header of the MCP connection. Set rules first with PUT https://screwtape.ai/v1/payment-guard/rules. A block is a normal result (isError false, decision "block").

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": {
      "event_id": "<event_id>",
      "agent_id": "<agent_id>",
      "amount_usd": "<amount_usd>"
    },
    "name": "payment_guard_authorize"
  }
}

Input Schema

NameRequiredDescriptionDefault
payeeNoPayee address or id, checked against allowed_sellers.
domainNoSeller hostname, checked against allowed_domains.
agent_idYesWhich agent wants to pay.
event_idYesYour id for this payment. Reusing it with the same body replays the decision.
amount_usdYesAmount the agent wants to pay.
seller_urlNoPublic https URL of the paid resource. Required for proxy.
payment_requiredNoOptional: the seller's 402 payload, used to read the payee.

Output Schema

NameRequiredDescriptionDefault
reasonYes
reasonsNo
decisionYes
replayedNo
clearanceNoEd25519-signed clearance on allow. Not a payment signature.
request_idYes
rules_sourceNo
rules_versionNo
remaining_daily_usdNo
remaining_period_usdNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

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

Goes well beyond the annotations: it discloses that allow reserves funds atomically, that block returns HTTP 403 with reasons and reserves nothing, that blocks arrive as a normal result (isError false), that responses replay without re-billing on the same event_id, the per-call billing model, the Bearer auth requirement, and that the service never holds funds or keys. All of this is consistent with readOnlyHint=false, idempotentHint=true, destructiveHint=false.

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?

Front-loaded with purpose and information-dense; most sentences (block semantics, billing, auth, non-custodial guarantee) carry unique value. It is a single long paragraph with heavy URL and rule-name enumeration that an agent must parse, so it is slightly denser than ideal but not padded.

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 budget-mutating, billed, authenticated call, everything an agent needs is present: setup prerequisite, auth transport over MCP, billing and replay behavior, and the numeric/legal safety guarantees. Return values are covered by the output schema, and the description still summarizes the decision field, so nothing material is missing.

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 description coverage is 100%, and the rule names in the description (allowed_sellers, allowed_domains, budgets, rate limits) are the config fields rather than explanations of the input parameters. The description does not add per-parameter meaning beyond what the schema already says, so baseline 3 applies.

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 opening sentence states a specific verb and resource: enforce spend rules and authorize a payment intent, returning either an Ed25519-signed clearance or a block. It also distinguishes this endpoint from the /proxy variant and from the rules endpoints, so the agent can tell what this tool does and does not do without opening the schema.

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 gives a clear prerequisite ("Set rules first with PUT .../rules") and describes the alternate path (proxy forwards the client-signed payment to the seller). What's missing is an explicit decision rule such as 'use authorize when you only need clearance, use proxy when you need the seller called' — the choice is inferable from the behavior sentences rather than stated.

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