Skip to main content
Glama

verify_mac

Verify a Message Authentication Code (MAC) on received payment messages or issuer scripts, using the same key and algorithm parameters as generation to confirm data integrity and authenticity.

Instructions

Call this to verify a MAC on a received payment message or issuer script. Mirrors generate_mac — use the same algorithm and key.

CMAC truncation warning: verify_mac with CMAC requires the FULL MAC value (16 bytes / 32H for AES-128). Passing a truncated CMAC — e.g. 4 bytes / 8H produced by payShield M6 with mac_size=0 — returns ValidationException with no descriptive error message. ISO 9797-1 Alg 1/3 produce 4-byte MACs natively and are not affected.

Workaround for truncated CMAC verify (e.g. bridging a payShield M8 flow):

  1. Call generate_mac with the same key and message.

  2. Compare the leading mac_length bytes of the returned 32H MAC against the received value. This costs one extra APC call per verify.

Args: key_identifier: ARN or alias of MAC key message_data: Hex-encoded message that was authenticated mac: Hex-encoded MAC value to verify (CMAC: must be full 32H, not truncated) verification_attributes: MAC algorithm parameters (mirrors generate_mac) mac_length: MAC length in nibbles/hex-digits (NOT bytes): 8=4-byte MAC, 16=8-byte MAC; must match the value used during generation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
macYes
mac_lengthNo
message_dataYes
key_identifierYes
verification_attributesYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv1.2.0

TDQS

A4.9/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 delivers: it warns that truncated CMAC yields ValidationException with no descriptive message, explains that ISO 9797-1 Alg 1/3 are unaffected, and quantifies the workaround cost as 'one extra APC call per verify.' These behaviors cannot be inferred from the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but every block earns its place: intent, sibling relationship, critical CMAC warning, workaround, then parameter documentation. The first sentence is immediately actionable and the warning is placed before the Args list.

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?

The description covers intent, algorithm relationship, edge cases, workaround, and all parameters thoroughly despite no annotations or output schema. It stops just short of stating the success/failure return semantics, such as whether an invalid MAC returns a false result or an exception, which would make the context fully complete in the absence of an output schema.

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 Args section compensates fully: key_identifier is typed as ARN or alias, message_data and mac are hex-encoded, mac must be full 32H for CMAC, verification_attributes mirrors generate_mac, and mac_length is clarified as nibbles not bytes with the 8/16 mapping and a must-match-generation constraint.

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: 'verify a MAC on a received payment message or issuer script.' It also anchors the tool's relationship to its primary sibling: 'Mirrors generate_mac — use the same algorithm and key,' so an agent can distinguish verification from generation without opening either schema.

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 states the call intent ('Call this to verify a MAC') and gives a concrete alternative path: for truncated CMAC verification, use generate_mac as a workaround to generate the full MAC and compare the leading bytes. The instruction to mirror generate_mac for algorithm and key makes the invocation context explicit.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/J8k3/aws-payment-cryptography-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server