Skip to main content
Glama
Frontier-Compute

Frontier-Compute/zcash-mcp

zcash_create_invoice

Generate a ZAP1 payment invoice. Specify amount in zatoshis, memo, and wallet hash to receive payment address, URI, and expiry.

Instructions

Create a ZAP1 payment invoice. Posts to the ZAP1 API and returns a payment address, amount, memo, zcash: URI, and expiry timestamp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amount_zatYesPayment amount in zatoshis (1 ZEC = 100_000_000 zatoshis)
memoYesMemo text attached to the invoice (max 512 bytes)
wallet_hashYesWallet identifier or hash for routing the payment

Implementation Reference

  • The handler function for the zcash_create_invoice tool. It POSTs to ZAP1 API /invoice with amount_zat, memo, and wallet_hash, then returns the invoice data (payment address, amount, memo, zcash: URI, expiry). On error, returns an error response.
    async ({ amount_zat, memo, wallet_hash }) => {
      try {
        const res = await fetch(`${ZAP1_API}/invoice`, {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({ amount_zat, memo, wallet_hash }),
          signal: AbortSignal.timeout(API_TIMEOUT_MS),
        });
    
        if (!res.ok) {
          const text = await res.text();
          throw new Error(`${res.status}: ${text}`);
        }
    
        const data = await res.json();
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(data, null, 2),
            },
          ],
        };
      } catch (err) {
        const msg = err instanceof Error ? err.message : String(err);
        return {
          content: [{ type: "text" as const, text: `Error: ${msg}` }],
          isError: true,
        };
      }
    }
  • Zod schema defining the input parameters: amount_zat (positive integer in zatoshis), memo (string max 512 bytes), and wallet_hash (string max 128 chars).
    {
      amount_zat: z.number().int().positive().describe("Payment amount in zatoshis (1 ZEC = 100_000_000 zatoshis)"),
      memo: z.string().max(512).describe("Memo text attached to the invoice (max 512 bytes)"),
      wallet_hash: z.string().max(128).describe("Wallet identifier or hash for routing the payment"),
    },
  • Registration of the tool via server.tool() with the name 'zcash_create_invoice', description, input schema, and handler function.
    server.tool(
      "zcash_create_invoice",
      "Create a ZAP1 payment invoice. Posts to the ZAP1 API and returns a payment address, amount, memo, zcash: URI, and expiry timestamp.",
      {
        amount_zat: z.number().int().positive().describe("Payment amount in zatoshis (1 ZEC = 100_000_000 zatoshis)"),
        memo: z.string().max(512).describe("Memo text attached to the invoice (max 512 bytes)"),
        wallet_hash: z.string().max(128).describe("Wallet identifier or hash for routing the payment"),
      },
      async ({ amount_zat, memo, wallet_hash }) => {
        try {
          const res = await fetch(`${ZAP1_API}/invoice`, {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({ amount_zat, memo, wallet_hash }),
            signal: AbortSignal.timeout(API_TIMEOUT_MS),
          });
    
          if (!res.ok) {
            const text = await res.text();
            throw new Error(`${res.status}: ${text}`);
          }
    
          const data = await res.json();
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(data, null, 2),
              },
            ],
          };
        } catch (err) {
          const msg = err instanceof Error ? err.message : String(err);
          return {
            content: [{ type: "text" as const, text: `Error: ${msg}` }],
            isError: true,
          };
        }
      }
    );
  • src/index.ts:42-42 (registration)
    Call to registerInvoiceTool from the main entry point, wiring the invoice tool into the MCP server.
    registerInvoiceTool(server);
  • Helper constants: ZAP1_API base URL (configurable via env var) and API_TIMEOUT_MS set to 15 seconds.
    const ZAP1_API = process.env.ZAP1_API_URL ?? "https://pay.frontiercompute.io";
    const API_TIMEOUT_MS = 15_000;
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses that it posts to ZAP1 API and returns specific fields, but does not mention side effects (e.g., state changes, reversibility, or prerequisites). Adequate but not thorough.

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?

Two sentences, no filler. Every word is functional. Front-loaded with purpose and returns.

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, description compensates by listing return fields. Lacks error conditions or prerequisites, but for a simple creation tool, it is sufficient for an agent to understand the basic operation.

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 coverage is 100% with each parameter already described in detail (zatoshis, max length, wallet hash). Description adds 'ZAP1' context but does not significantly enhance understanding beyond the schema.

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?

Description uses specific verb 'Create' and resource 'ZAP1 payment invoice', and lists returned fields (payment address, amount, memo, URI, expiry). Clearly distinguishes from siblings like 'zcash_create_wallet' and 'zcash_watch_payment'.

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?

No explicit when-to-use or alternatives are mentioned. Usage is implied by purpose, but no guidance on when not to use or how it relates to payment-related siblings.

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

Install Server

Other Tools

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/Frontier-Compute/zcash-mcp'

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