get_whitelisted_markets
Fetch whitelisted markets from Morpho using this tool to streamline access to approved market data through the Morpho API MCP Server.
Instructions
Retrieves only whitelisted markets from Morpho.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:635-641 (registration)Registration of the get_whitelisted_markets tool in the tools list returned by listTools. Defines name, description, and input schema (empty object as no params required).
name: GET_WHITELISTED_MARKETS_TOOL, description: 'Retrieves only whitelisted markets from Morpho.', inputSchema: { type: 'object', properties: {}, // No input parameters for this tool }, }, - src/index.ts:973-1027 (handler)Core handler logic for executing the get_whitelisted_markets tool. Sends a GraphQL query to Morpho API for whitelisted markets, parses response, and returns JSON text content.
if (name === GET_WHITELISTED_MARKETS_TOOL) { try { const query = ` query { markets(where:{whitelisted: true}) { items { whitelisted uniqueKey lltv oracleAddress irmAddress loanAsset { address symbol decimals } collateralAsset { address symbol decimals } state { borrowApy borrowAssets borrowAssetsUsd supplyApy supplyAssets supplyAssetsUsd fee utilization } } } } `; const response = await axios.post(MORPHO_API_BASE, { query }); const validatedData = MorphoApiResponseSchema.parse(response.data); return { content: [ { type: 'text', text: JSON.stringify(validatedData.data.markets.items, null, 2), }, ], }; } catch (error: any) { console.error('Error calling Morpho API:', error.message); return { isError: true, content: [{ type: 'text', text: `Error retrieving whitelisted markets: ${error.message}` }], }; } } - src/index.ts:136-136 (helper)Constant defining the tool name string to avoid typos in registrations and conditionals.
const GET_WHITELISTED_MARKETS_TOOL = 'get_whitelisted_markets';