Skip to main content
Glama

get_protocol_summary

Generate human-readable summaries of Voi protocols including purpose, contracts, and assets to understand blockchain ecosystem services.

Instructions

Get a human-readable summary of a Voi protocol including its purpose, contracts, and assets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protocolIdYesProtocol identifier (e.g. humble-swap, envoi, aramid-bridge)

Implementation Reference

  • The handler function for get_protocol_summary tool. It retrieves protocol details, contracts, and assets, then formats them into a human-readable markdown summary with sections for type, website, description, contracts (grouped by type), assets, and tags.
      async ({ protocolId }) => {
        const protocol = findProtocol(protocolId);
        if (!protocol) {
          return toolError(`Unknown protocol: ${protocolId}`);
        }
        const contracts = protocolContracts(protocolId);
        const assets = protocolAssets(protocolId);
    
        const lines = [
          `# ${protocol.name}`,
          ``,
          `**Type:** ${protocol.type}`,
          `**Website:** ${protocol.website || "N/A"}`,
          ``,
          protocol.description,
          ``,
          `## Contracts (${contracts.length})`,
        ];
    
        const byType = {};
        for (const c of contracts) {
          const t = c.type || "other";
          if (!byType[t]) byType[t] = [];
          byType[t].push(c);
        }
        for (const [type, items] of Object.entries(byType)) {
          lines.push(`- **${type}**: ${items.length} contract(s)`);
          for (const item of items.slice(0, 5)) {
            lines.push(`  - ${item.appId}: ${item.name}`);
          }
          if (items.length > 5) {
            lines.push(`  - ... and ${items.length - 5} more`);
          }
        }
    
        if (assets.length > 0) {
          lines.push(``, `## Assets (${assets.length})`);
          for (const a of assets) {
            lines.push(`- ${a.symbol} (${a.assetId}): ${a.name} — ${a.category}`);
          }
        }
    
        lines.push(``, `**Tags:** ${(protocol.tags || []).join(", ")}`);
    
        return { content: [{ type: "text", text: lines.join("\n") }] };
      },
    );
  • Zod schema definition for the protocolId input parameter, requiring a string that describes the protocol identifier (e.g. humble-swap, envoi, aramid-bridge).
    {
      protocolId: z
        .string()
        .describe("Protocol identifier (e.g. humble-swap, envoi, aramid-bridge)"),
    },
  • Registration of the get_protocol_summary tool with the MCP server using server.tool(), including the tool name, description, input schema, and handler function.
    server.tool(
      "get_protocol_summary",
      "Get a human-readable summary of a Voi protocol including its purpose, contracts, and assets",
      {
        protocolId: z
          .string()
          .describe("Protocol identifier (e.g. humble-swap, envoi, aramid-bridge)"),
      },
      async ({ protocolId }) => {
        const protocol = findProtocol(protocolId);
        if (!protocol) {
          return toolError(`Unknown protocol: ${protocolId}`);
        }
        const contracts = protocolContracts(protocolId);
        const assets = protocolAssets(protocolId);
    
        const lines = [
          `# ${protocol.name}`,
          ``,
          `**Type:** ${protocol.type}`,
          `**Website:** ${protocol.website || "N/A"}`,
          ``,
          protocol.description,
          ``,
          `## Contracts (${contracts.length})`,
        ];
    
        const byType = {};
        for (const c of contracts) {
          const t = c.type || "other";
          if (!byType[t]) byType[t] = [];
          byType[t].push(c);
        }
        for (const [type, items] of Object.entries(byType)) {
          lines.push(`- **${type}**: ${items.length} contract(s)`);
          for (const item of items.slice(0, 5)) {
            lines.push(`  - ${item.appId}: ${item.name}`);
          }
          if (items.length > 5) {
            lines.push(`  - ... and ${items.length - 5} more`);
          }
        }
    
        if (assets.length > 0) {
          lines.push(``, `## Assets (${assets.length})`);
          for (const a of assets) {
            lines.push(`- ${a.symbol} (${a.assetId}): ${a.name} — ${a.category}`);
          }
        }
    
        lines.push(``, `**Tags:** ${(protocol.tags || []).join(", ")}`);
    
        return { content: [{ type: "text", text: lines.join("\n") }] };
      },
    );
  • findProtocol helper function that searches the protocols list to find a protocol by its ID, returning null if not found.
    export function findProtocol(id) {
      return getProtocols().find((p) => p.id === id) || null;
    }
  • protocolContracts and protocolAssets helper functions that filter applications and assets by protocol ID, returning arrays with appId/assetId and their associated info.
    export function protocolContracts(protocolId) {
      const apps = getApplications();
      const results = [];
      for (const [appId, info] of Object.entries(apps)) {
        if (info.protocol === protocolId) {
          results.push({ appId: Number(appId), ...info });
        }
      }
      return results;
    }
    
    export function protocolAssets(protocolId) {
      const a = getAssets();
      const results = [];
      for (const [assetId, info] of Object.entries(a)) {
        if (info.protocol === protocolId) {
          results.push({ assetId: Number(assetId), ...info });
        }
      }
      return results;
    }

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/MaidToShelly/UluVoiMCP'

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