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
| Name | Required | Description | Default |
|---|---|---|---|
| appId | Yes | Application ID on Voi |
Implementation Reference
- tools/identify.js:74-104 (handler)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, }); }, - lib/registry.js:42-45 (helper)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; } - lib/registry.js:38-40 (helper)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; } - lib/errors.js:1-3 (helper)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) }] }; }