Skip to main content
Glama
crazyrabbitLTC

Morpho API MCP Server

get_oracle_details

Retrieve detailed oracle information for a specific market using marketUniqueKey and chainId as inputs. Part of the Morpho API MCP Server for accessing market data.

Instructions

Get oracle details for a specific market.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainIdNo
marketUniqueKeyYes

Implementation Reference

  • Handler function that executes the get_oracle_details tool by constructing a GraphQL query to fetch oracle details for a given market unique key and chain ID, validates the response, and returns the data.
    if (name === GET_ORACLE_DETAILS_TOOL) {
        try {
              const { marketUniqueKey, chainId = 1 } = params as OracleDetailsParams;
              const query = `
              query {
                marketByUniqueKey(
                  uniqueKey: "${marketUniqueKey}"
                  chainId: ${chainId}
                ) {
                  oracle {
                    address
                    type
                    data {
                      ... on MorphoChainlinkOracleData {
                        baseFeedOne {
                          address
                          description
                          vendor
                          pair
                        }
                        vault
                      }
                      ... on MorphoChainlinkOracleV2Data {
                        baseFeedOne {
                          address
                          description
                          vendor
                          pair
                        }
                      }
                    }
                  }
                }
              }`;
    
              const response = await axios.post(MORPHO_API_BASE, { query });
              const validatedData = OracleDetailsResponseSchema.parse(response.data);
    
              return {
                content: [{ type: 'text', text: JSON.stringify(validatedData.data.marketByUniqueKey, null, 2) }],
              };
        } catch (error: any) {
              return {
                isError: true,
                content: [{ type: 'text', text: `Error retrieving oracle details: ${error.message}` }],
              };
        }
    }
  • src/index.ts:719-729 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the name, description, and input schema for get_oracle_details.
      name: GET_ORACLE_DETAILS_TOOL,
      description: 'Get oracle details for a specific market.',
      inputSchema: {
        type: 'object',
        properties: {
          marketUniqueKey: { type: 'string' },
          chainId: { type: 'number' }
        },
        required: ['marketUniqueKey']
      },
    },
  • Zod response schema used to validate the API response in the get_oracle_details handler.
    const OracleDetailsResponseSchema = z.object({
      data: z.object({
        marketByUniqueKey: z.object({
          oracle: OracleSchema,
        }),
      }),
    });
  • Core Zod schemas defining the Oracle, OracleData, and OracleFeed structures used in validation for get_oracle_details.
    const OracleFeedSchema = z.object({
      address: z.string(),
      description: z.string(),
      vendor: z.string(),
      pair: z.string(),
    });
    
    // Oracle Data Schema
    const OracleDataSchema = z.discriminatedUnion('type', [
      z.object({
        type: z.literal('MorphoChainlinkOracle'),
        baseFeedOne: OracleFeedSchema,
        vault: z.string(),
      }),
      z.object({
        type: z.literal('MorphoChainlinkOracleV2'),
        baseFeedOne: OracleFeedSchema,
      }),
    ]);
    
    // Oracle Schema
    const OracleSchema = z.object({
      address: z.string(),
      type: z.string(),
      data: OracleDataSchema,
    });
  • src/index.ts:312-312 (registration)
    Constant definition for the tool name used throughout the code.
    const GET_ORACLE_DETAILS_TOOL = 'get_oracle_details';

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/crazyrabbitLTC/mcp-morpho-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server