listSupportedFeedsByChain
Get available Chainlink price feeds for a specific blockchain network to identify supported data sources for decentralized applications.
Instructions
Returns a comma-separated list of price feed names for a specified blockchain network
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:200-224 (handler)The handler function that destructures the 'chain' parameter, validates it using the schema, retrieves the list of feed names from feedsData for that chain, joins them into a comma-separated string, and returns it as text content. Handles errors by returning an error message.async ({ chain }) => { try { // Validate inputs const chainKey = chain.toLowerCase(); listSupportedFeedsByChainSchema.parse({ chain }); // Get feed names as comma-separated string const feedNames = feedsData[chainKey].feeds.map((feed) => feed.name).join(','); return { content: [{ type: 'text', text: feedNames }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true }; } }
- index.js:189-193 (schema)Zod schema defining the input parameters for the tool: an object with a required 'chain' string that must correspond to a key in feedsData (validated via refine). Includes description.const listSupportedFeedsByChainSchema = z.object({ chain: z.string().refine((val) => feedsData[val.toLowerCase()], { message: 'Unsupported chain' }).describe('The blockchain network, e.g., ethereum or base') });
- index.js:196-225 (registration)Registers the 'listSupportedFeedsByChain' tool with the MCP server via server.tool(), providing the tool name, description, input schema, and inline asynchronous handler function.server.tool( 'listSupportedFeedsByChain', 'Returns a comma-separated list of price feed names for a specified blockchain network', listSupportedFeedsByChainSchema, async ({ chain }) => { try { // Validate inputs const chainKey = chain.toLowerCase(); listSupportedFeedsByChainSchema.parse({ chain }); // Get feed names as comma-separated string const feedNames = feedsData[chainKey].feeds.map((feed) => feed.name).join(','); return { content: [{ type: 'text', text: feedNames }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true }; } } );