list_famous_contracts
Lists well-known contracts for a selected Neo N3 network (mainnet or testnet).
Instructions
List supported well-known contracts for the selected network.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | Network to use: "mainnet" or "testnet" |
Implementation Reference
- src/handlers/tool-handler.ts:486-497 (handler)Main handler function that executes the 'list_famous_contracts' tool logic. It calls contractService.listSupportedContracts(), filters for available contracts, and returns the list along with the network name.
async function handleListFamousContracts(input: Record<string, unknown>, contractService: ContractService): Promise<unknown> { try { const contracts = await contractService.listSupportedContracts(); const availableContracts = contracts.filter(contract => contract.available); return { contracts: availableContracts, network: contractService.getNetwork() }; } catch (error) { return handleError(error); } } - Tool registration schema defining name, description, and input schema for 'list_famous_contracts'. The input has an optional 'network' parameter restricted to 'mainnet' or 'testnet'.
{ name: 'list_famous_contracts', description: 'List known famous contracts with their names and script hashes for the active network(s)', inputSchema: { type: 'object', properties: { network: { type: 'string', description: 'Optional: Filter by network ("mainnet" or "testnet"). Defaults to showing contracts for all configured networks.', enum: [NeoNetwork.MAINNET, NeoNetwork.TESTNET], }, }, required: [], }, }, - src/handlers/tool-handler.ts:636-637 (registration)Case statement in the callTool switch that routes the 'list_famous_contracts' tool name to the handleListFamousContracts handler.
case 'list_famous_contracts': return await handleListFamousContracts(input, contractService) as Record<string, unknown>; - src/index.ts:408-424 (registration)MCP server-side tool registration via registerTool() for 'list_famous_contracts' with Zod schema (optional network param) and delegation to callTool().
// List famous contracts tool registerTool( 'list_famous_contracts', 'List supported well-known contracts for the selected network.', { network: z.string().optional().describe('Network to use: "mainnet" or "testnet"'), }, async (args) => { try { await this.ensureServicesInitialized(); const result = await callTool('list_famous_contracts', args, this.neoServices, this.contractServices); return this.formatDelegatedToolResponse(result); } catch (error: unknown) { return this.createErrorResponse(error); } } ); - listSupportedContracts() helper method in ContractService. Iterates over FAMOUS_CONTRACTS definitions, checks each contract's deployment status on the active network, and returns their name, description, availability, operation count, and network.
async listSupportedContracts(): Promise<Array<{ name: string, description: string, available: boolean, operationCount: number, network: NeoNetwork }>> { try { const contracts = await Promise.all(Object.values(FAMOUS_CONTRACTS).map(async (contract) => { const contractName = contract.name; const isAvailable = await this.isContractDeployed(contractName); const operationCount = Object.keys(contract.operations).length; return { name: contractName, description: contract.description, available: isAvailable, operationCount, network: this.network }; })); return contracts; } catch (error) { logger.error(`Error listing supported contracts`, { error: error instanceof Error ? error.message : String(error), network: this.network }); return []; } }