Skip to main content
Glama

hcs_write_record

Write tamper-evident compliance records to the Hedera blockchain for transactions, approvals, or audit events, providing record IDs and transaction proofs.

Instructions

Write a tamper-evident compliance record to the Hedera blockchain. Returns a record ID and transaction proof. If no topic_id is provided, writes to the shared HederaIntel platform topic. Costs 2 HBAR.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesYour HederaIntel API key
record_typeYesType of compliance record (e.g. transaction, approval, audit_event)
entity_idYesID of the entity this record relates to
dataYesThe compliance data to record (any JSON object)
topic_idNoHCS topic ID to write the record to. Defaults to the HederaIntel platform topic.

Implementation Reference

  • The handler for hcs_write_record which creates a record object, computes its SHA-256 hash, submits it to a Hedera HCS topic, and returns the result.
    if (name === "hcs_write_record") {
      const payment = chargeForTool("hcs_write_record", args.api_key);
      const client = getClient();
      const topicId = args.topic_id || PLATFORM_TOPIC;
    
      const record = {
        record_id: crypto.randomUUID(),
        record_type: args.record_type,
        entity_id: args.entity_id,
        data: args.data,
        written_at: new Date().toISOString(),
        written_by: process.env.HEDERA_ACCOUNT_ID,
      };
    
      const hash = crypto
        .createHash("sha256")
        .update(JSON.stringify(record))
        .digest("hex");
    
      record.hash = hash;
    
      const tx = await new TopicMessageSubmitTransaction()
        .setTopicId(topicId)
        .setMessage(JSON.stringify(record))
        .execute(client);
    
      const receipt = await tx.getReceipt(client);
    
      return {
        success: true,
        record_id: record.record_id,
        topic_id: topicId,
        entity_id: args.entity_id,
        record_type: args.record_type,
        hash,
        transaction_id: tx.transactionId.toString(),
        written_at: record.written_at,
        verification_note: "This record is permanently stored on the Hedera blockchain and cannot be altered.",
        payment,
        timestamp: new Date().toISOString(),
      };
    }
  • The schema definition for hcs_write_record.
    {
      name: "hcs_write_record",
      description: "Write a tamper-evident compliance record to the Hedera blockchain. Returns a record ID and transaction proof. If no topic_id is provided, writes to the shared HederaToolbox platform topic. Sends a webhook notification on every write. Costs 5 HBAR.",
      inputSchema: {
        type: "object",
        properties: {
          topic_id: { type: "string", description: "HCS topic ID to write the record to. Defaults to the HederaIntel platform topic." },
          record_type: { type: "string", description: "Type of compliance record (e.g. transaction, approval, audit_event)" },
          entity_id: { type: "string", description: "ID of the entity this record relates to" },
          data: { type: "object", description: "The compliance data to record (any JSON object)" },
          api_key: { type: "string", description: "Your HederaIntel API key" },
        },
        required: ["record_type", "entity_id", "data", "api_key"],
      },
    },
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively adds context beyond basic functionality: it specifies the cost ('Costs 2 HBAR'), the default behavior for topic_id, and the return values (record ID and transaction proof). This covers key operational traits like financial implications and output format, though it doesn't mention error handling or rate limits.

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 front-loaded with the core purpose and key details (returns, default topic, cost) in just three sentences, with zero waste. Each sentence earns its place by conveying essential information efficiently, making it easy for an agent to parse quickly.

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?

Given the complexity of a blockchain write operation with no annotations and no output schema, the description does well by covering purpose, usage context, cost, and return values. However, it could be more complete by addressing potential errors, authentication needs beyond the api_key parameter, or linking to sibling tools for related tasks, leaving minor gaps in full contextual understanding.

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%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by mentioning the default for topic_id, but it doesn't provide additional syntax, format details, or examples. This meets the baseline of 3 for high schema coverage.

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 clearly states the specific action ('Write a tamper-evident compliance record') and resource ('to the Hedera blockchain'), distinguishing it from sibling tools like hcs_audit_trail or hcs_query. It explicitly mentions the outcome ('Returns a record ID and transaction proof'), making the purpose unambiguous and distinct.

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?

The description provides clear context for when to use this tool by stating it writes records to the blockchain, with an implicit alternative (using a custom topic_id vs. the default platform topic). However, it lacks explicit guidance on when not to use it or comparisons to siblings like hcs_verify_record, which might be for verification instead of writing.

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/mountainmystic/hederatoolbox'

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