Skip to main content
Glama

Redeem an action grant

redeem_action_grant
Destructive

Spend the single-use grant request_action gave you, immediately before you perform the allowed action, and act only if the answer is redeemed. A grant is good for ONE action: the first redemption marks it used and every later attempt is refused, so redeem once, right before you act. Pass grant_id and the grant's digest; the request_id your job says you are fulfilling (from the job, never copied out of the grant); the system, operation and target_kind of the action; and param_digest, computed from the action's target id and params with the grant's param_salt (HMAC-SHA256; the recipe is in the parameter description and in Maplith's docs). Maplith checks all of them against the request and the grant in one atomic update and refuses if they differ, so a grant for a refund of 120 on one order never authorises 999,999 on another. Any key of the same workspace may redeem (the executor is usually another key than the asker), never a key of another workspace. Any answer but redeemed means do not act: already_redeemed (done, perhaps by your own retry), expired (ask again with a new idempotency_key), wrong_action or params_mismatch (the grant is not used up), params_required (no param_digest), params_unbound (ask again), revoked, or refused. Needs: a key with an action policy (Agents & access › Policies › What each agent may do), where Maplith signs grants.

Input Schema

NameRequiredDescriptionDefault
digestYesThe grant's digest, exactly as it was given to you. Pass it through unchanged: it is a bearer factor — proof you hold what Maplith issued — and NOT a check on the action, because Maplith hashes the parameters in the masked form it stored, so an executor cannot recompute it from the values it holds. What binds the action is system, operation and target_kind, and param_digest.
systemYesThe system you are about to act in, as the catalogue names it, e.g. "payments". Checked against the request the grant was issued for.
grant_idYesThe grant_id from the grant request_action returned.
operationYesThe operation you are about to perform, e.g. "issue_refund". Checked against the request the grant was issued for.
request_idYesThe request your job says you are fulfilling -- taken from the job you were handed, NOT copied out of the grant, or the check compares the grant with itself. Checked against the grant.
target_kindYesThe kind of thing you are about to act on, e.g. "order". Checked against the request the grant was issued for.
param_digestNoThe parameter binding, COMPUTED by you: base64url(HMAC-SHA256(key = the grant's param_salt, base64url-decoded; message = 'maplith-action-params/v1' + newline + the canonical encoding of {system, operation, target: {kind, id}, params} of the action you are about to perform, exactly as it was sent to request_action)). Never copy it out of the grant. Required for every grant that carries a param_salt.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructive/non-idempotent, and the description adds real context beyond them: atomic server-side validation, single-use consumption semantics, cross-workspace authorization boundaries (any key of the same workspace, never another's), and the full enumeration of refusal states with their consequences. No contradiction with destructiveHint=true or idempotentHint=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?

The critical rule — one redemption, act only on 'redeemed' — is front-loaded and repeated as a safeguard, which is appropriate for a destructive tool. It is a dense run-on paragraph with a long trailing error-code list, so structure could be tighter, but nearly every sentence carries operational weight.

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?

There is no output schema, and the description compensates by enumerating the return states (redeemed, already_redeemed, expired, wrong_action, params_mismatch, params_required, params_unbound, revoked, refused) and what each implies. Combined with the auth prerequisite ('a key with an action policy'), an agent has everything needed to call and interpret this tool.

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 100%, so the baseline is 3; the description still adds value by explaining *why* each value must come from a particular source (request_id from the job, not the grant; digest as a bearer factor) and by summarizing the HMAC-SHA256 param_digest recipe. Much of this is mirrored in the parameter descriptions, keeping it short of a 5.

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?

States a specific verb and resource ('Spend the single-use grant request_action gave you') and immediately distinguishes it from the sibling that issues grants. The one-action/one-redemption scope is spelled out, so an agent knows exactly what this tool does differently from request_action.

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?

Gives explicit timing ('immediately before you perform the allowed action'), the gating rule ('act only if the answer is redeemed'), and the failure-handling branch ('any answer but redeemed means do not act') with per-code guidance. It also names the alternative (request_action) and when to re-ask with a new idempotency_key on expiry.

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