get_protocol_contracts
Retrieve all application contracts for a specific Voi protocol to identify contract roles and explore ecosystem services.
Instructions
List all known application contracts for a Voi protocol
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| protocolId | Yes | Protocol identifier (e.g. humble-swap, envoi, aramid-bridge) |
Implementation Reference
- tools/protocols.js:63-76 (handler)The async handler function that executes the 'get_protocol_contracts' tool logic. It validates the protocol exists using findProtocol(), retrieves contracts via protocolContracts(), assets via protocolAssets(), and returns the combined result.
async ({ protocolId }) => { const protocol = findProtocol(protocolId); if (!protocol) { return toolError(`Unknown protocol: ${protocolId}`); } const contracts = protocolContracts(protocolId); const assets = protocolAssets(protocolId); return toolResult({ protocol: protocolId, name: protocol.name, contracts, assets, }); }, - tools/protocols.js:58-62 (schema)Input schema definition for 'get_protocol_contracts' tool using Zod. Defines a required 'protocolId' string parameter with description.
{ protocolId: z .string() .describe("Protocol identifier (e.g. humble-swap, envoi, aramid-bridge)"), }, - tools/protocols.js:55-77 (registration)Registration of the 'get_protocol_contracts' tool with the MCP server using server.tool(). Includes tool name, description, schema, and handler.
server.tool( "get_protocol_contracts", "List all known application contracts for a Voi protocol", { 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); return toolResult({ protocol: protocolId, name: protocol.name, contracts, assets, }); }, ); - lib/registry.js:52-61 (helper)Helper function that retrieves all application contracts for a given protocol ID by filtering the applications registry.
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; }