Skip to main content
Glama

get_contract_role

Identify the role and purpose of a Voi blockchain contract, such as liquidity pool, bridge, or registry, by providing its application ID.

Instructions

Get the role and purpose of a specific contract on Voi (e.g. liquidity-pool, bridge, registry)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesApplication ID on Voi

Implementation Reference

  • Handler function for get_contract_role tool that looks up a contract by appId, retrieves its role, type, name, protocol, and description from the registry, and returns formatted results
    server.tool(
      "get_contract_role",
      "Get the role and purpose of a specific contract on Voi (e.g. liquidity-pool, bridge, registry)",
      {
        appId: z
          .number()
          .int()
          .describe("Application ID on Voi"),
      },
      async ({ appId }) => {
        const app = findApplication(appId);
        if (!app) {
          return toolResult({
            appId,
            known: false,
            role: null,
            message: `Contract ${appId} is not in the Voi ecosystem registry`,
          });
        }
        const protocol = app.protocol ? findProtocol(app.protocol) : null;
        return toolResult({
          appId,
          known: true,
          role: app.role,
          type: app.type,
          name: app.name,
          protocol: app.protocol,
          protocolName: protocol?.name || null,
          description: app.description,
        });
      },
  • Helper function that looks up an application in the registry by appId, returning null if not found
    export function findApplication(appId) {
      const apps = getApplications();
      return apps[String(appId)] || null;
    }
  • Helper function that finds a protocol by ID to provide protocol name for the application
    export function findProtocol(id) {
      return getProtocols().find((p) => p.id === id) || null;
    }
  • Helper function that formats tool response data as JSON text content for MCP protocol
    export function toolResult(data) {
      return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
    }

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