Skip to main content
Glama

Decode a Bitcoin script

bitcoin_decode_script
Read-onlyIdempotent

Decode a Bitcoin script from hex (scriptPubKey, redeem or witness script): type, asm, descriptor, address, and the P2SH and P2WSH addresses that wrap it (Bitcoin Core decodescript). Paid per call. Price: 2 sats or US$0.002 (USDC) per call.

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": {
      "script": "<script>"
    },
    "name": "bitcoin_decode_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
l402NoOptional. After paying the Lightning invoice: '<token>:<preimage>'.
passNoOptional. A Diamond budget token (dp_...) that your user approved once (from US$0.89; USDC or other Base tokens, or Lightning) or that you funded with the free diamond_budget tool. Each call deducts its price; no wallet needed in the agent.
scriptYesA Bitcoin script as hex
pay_withNoOptional. 'lightning' requests a BOLT11 invoice and a token when Diamond can receive Lightning payments.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / pay_with / description
      Previous value: -"Optional. 'lightning' returns a BOLT11 invoice and a token instead of the x402 payment request."New value: +"Optional. 'lightning' requests a BOLT11 invoice and a token when Diamond can receive Lightning payments."
  2. Changed1 schema field changed
    • changedInput schema / properties / pass / description
      Previous value: -"Optional. A Diamond pass (dp_...) that your user funded in a browser (USDC on Base or Lightning, from US$1). Each call deducts its price; no wallet needed in the agent."New value: +"Optional. A Diamond budget token (dp_...) that your user approved once (from US$0.89; USDC or other Base tokens, or Lightning) or that you funded with the free diamond_budget tool. Each call deducts its price; no wallet needed in the agent."
  3. Changed1 schema field changed
    • addedInput schema / properties / pass
      Added value: +{
      +  "description": "Optional. A Diamond pass (dp_...) that your user funded in a browser (USDC on Base or Lightning, from US$1). Each call deducts its price; no wallet needed in the agent.",
      +  "type": "string"
      +}
  4. Added

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already cover read-only, idempotent, and closed-world behavior, so the description's job is supplementary — and it delivers the commercial behavior the annotations omit: paid per call at 2 sats or US$0.002 USDC. It does not spell out what happens if no payment credential is supplied, but the cost disclosure is genuine added context.

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?

Two sentences, front-loaded with the operation and its outputs, then pricing. The parenthetical list is dense but every element (output fields, Core equivalence, script types) carries information; no filler sentences.

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?

With no output schema, the description correctly enumerates the returned fields so an agent knows what it gets back, and the read-only annotations plus full schema coverage handle the rest. The only gap is the payment lifecycle (what an unpaid call returns and whether it yields an invoice), which matters for a metered tool.

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%, including the l402 token format '<token>:<preimage>', the dp_ budget token, and the pay_with enum, so the schema carries the parameter meaning. The description adds only 'from hex' for the script argument and confirms the price that the payment parameters will deduct — baseline 3 is appropriate when the schema does the heavy lifting.

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?

Specific verb+resource ('Decode a Bitcoin script from hex') plus an enumeration of accepted script forms (scriptPubKey, redeem, witness script) and the return fields (type, asm, descriptor, address, P2SH/P2WSH wrappers). The Bitcoin Core decodescript reference and the explicit output list distinguish it from siblings like bitcoin_decode_transaction and bitcoin_decode_psbt 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 Guidelines3/5

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

Accepting 'scriptPubKey, redeem or witness script' implies the use case (raw script rather than a whole transaction or PSBT), but there is no explicit when-to-use/when-not statement and no sibling routing, e.g. 'to decode a full transaction use bitcoin_decode_transaction'. Usage is inferable 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