Skip to main content
Glama

governance_analyze

Analyze governance proposals to assess voter sentiment, participation rates, token concentration, and predict outcomes for informed decision-making.

Instructions

Deep analysis of a governance proposal including voter sentiment, participation rate, token concentration, and outcome prediction. Costs 0.5 HBAR.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesYour HederaIntel API key
token_idYesHedera token ID the proposal belongs to
proposal_idYesProposal ID or HCS sequence number to analyze
topic_idNoHCS topic ID where proposal votes are recorded

Implementation Reference

  • Handler implementation for the governance_analyze tool, which performs deep analysis of a proposal.
    if (name === "governance_analyze") {
      const payment = chargeForTool("governance_analyze", args.api_key);
      const base = getMirrorNodeBase();
    
      // Fetch token info
      const tokenRes = await axios.get(`${base}/api/v1/tokens/${args.token_id}`);
      const token = tokenRes.data;
    
      // Fetch all votes for this proposal from HCS topic if provided
      let votes = { yes: 0, no: 0, abstain: 0, total: 0, voters: [] };
      let proposalDetails = null;
    
      if (args.topic_id) {
        const msgRes = await axios.get(
          `${base}/api/v1/topics/${args.topic_id}/messages?limit=100&order=asc`
        );
        const messages = msgRes.data.messages || [];
    
        for (const msg of messages) {
          try {
            const content = Buffer.from(msg.message, "base64").toString("utf-8");
            const parsed = JSON.parse(content);
    
            // Find the original proposal
            if (
              (parsed.type === "proposal" || parsed.proposal_id) &&
              String(parsed.proposal_id || msg.sequence_number) === String(args.proposal_id)
            ) {
              proposalDetails = {
                title: parsed.title || "Untitled Proposal",
                description: parsed.description || "No description provided.",
                created_at: msg.consensus_timestamp,
                deadline: parsed.deadline || null,
                proposer: parsed.proposer || null,
              };
            }
    
            // Tally votes for this proposal
            if (parsed.type === "vote" && String(parsed.proposal_id) === String(args.proposal_id)) {
              const v = (parsed.vote || "").toLowerCase();
              if (v === "yes") votes.yes++;
              else if (v === "no") votes.no++;
              else votes.abstain++;
              votes.total++;
              votes.voters.push({ voter: parsed.voter_id, vote: v, timestamp: msg.consensus_timestamp });
            }
          } catch (e) {
            continue;
          }
        }
      }
    
      // Token holder concentration
      const holderRes = await axios.get(
        `${base}/api/v1/tokens/${args.token_id}/balances?limit=20&order=desc`
      ).catch(() => ({ data: { balances: [] } }));
    
      const holders = holderRes.data.balances || [];
      const totalSupply = parseInt(token.total_supply || 0);
      const top5Balance = holders.slice(0, 5).reduce((s, b) => s + parseInt(b.balance || 0), 0);
      const concentrationPct = totalSupply > 0 ? ((top5Balance / totalSupply) * 100).toFixed(1) : "unknown";
    
      // Participation rate
      const participationRate = votes.total > 0 && holders.length > 0
        ? ((votes.total / holders.length) * 100).toFixed(1) + "%"
        : "unknown";
    
      // Simple outcome prediction
      let prediction = "Insufficient votes to predict outcome.";
      if (votes.total > 0) {
        const yesPct = (votes.yes / votes.total) * 100;
        const noPct = (votes.no / votes.total) * 100;
        if (yesPct > 60) prediction = "Likely to PASS - strong yes majority.";
        else if (noPct > 60) prediction = "Likely to FAIL - strong no majority.";
        else if (yesPct > noPct) prediction = "Leaning YES but outcome uncertain.";
        else if (noPct > yesPct) prediction = "Leaning NO but outcome uncertain.";
        else prediction = "Tied - outcome is uncertain.";
      }
    
      return {
        proposal_id: args.proposal_id,
        token_id: args.token_id,
        token_name: token.name || "Unknown",
        proposal: proposalDetails || { note: "Proposal details not found in topic. It may use off-chain governance." },
        vote_tally: {
          yes: votes.yes,
          no: votes.no,
          abstain: votes.abstain,
          total: votes.total,
          yes_pct: votes.total > 0 ? ((votes.yes / votes.total) * 100).toFixed(1) + "%" : "0%",
          no_pct: votes.total > 0 ? ((votes.no / votes.total) * 100).toFixed(1) + "%" : "0%",
        },
        participation_rate: participationRate,
        token_concentration: {
          top_5_holders_pct: concentrationPct + "%",
          note: concentrationPct > 50
            ? "High concentration - top 5 holders control majority of supply."
            : "Reasonably distributed token supply.",
        },
        outcome_prediction: prediction,
        recent_voters: votes.voters.slice(-10),
        payment,
        timestamp: new Date().toISOString(),
      };
    }
  • Input schema and tool definition for governance_analyze.
      name: "governance_analyze",
      description: "Deep analysis of a governance proposal including voter sentiment, participation rate, token concentration, and outcome prediction. Costs 1.0 HBAR.",
      inputSchema: {
        type: "object",
        properties: {
          token_id: { type: "string", description: "Hedera token ID the proposal belongs to" },
          proposal_id: { type: "string", description: "Proposal ID or HCS sequence number to analyze" },
          topic_id: { type: "string", description: "HCS topic ID where proposal votes are recorded" },
          api_key: { type: "string", description: "Your HederaIntel API key" },
        },
        required: ["token_id", "proposal_id", "api_key"],
      },
    },
  • src/tools.js:247-247 (registration)
    Tool registration for governance_analyze within the main tools registry.
    name: "governance_analyze",
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the cost (0.5 HBAR), which is a behavioral trait, but does not cover other aspects like rate limits, authentication needs beyond the api_key parameter, or what happens if the proposal is invalid. The description adds some value but lacks comprehensive behavioral context.

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 a single, efficient sentence that front-loads the purpose and includes key details (analytical components and cost). Every part earns its place with no wasted words, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is moderately complete. It covers the purpose and cost but lacks details on output format, error handling, or prerequisites. For a tool with 4 parameters and analytical complexity, more context would be helpful, but it meets a minimum viable level.

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. The description does not add any meaning beyond what the schema provides, such as explaining how parameters interact or their significance in the analysis. Baseline 3 is appropriate when the schema handles parameter documentation.

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 ('Deep analysis') and resource ('governance proposal'), listing the analytical components (voter sentiment, participation rate, token concentration, outcome prediction). It distinguishes from siblings like 'governance_monitor' by focusing on deep analysis rather than monitoring.

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?

The description implies usage for analyzing governance proposals with specific metrics, but does not explicitly state when to use this tool versus alternatives like 'governance_monitor' or 'contract_analyze'. It mentions a cost (0.5 HBAR), which provides some context but not clear guidance on tool selection.

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