Skip to main content
Glama

get_vault_apy_history

Retrieve historical Annual Percentage Yield (APY) data for a specific vault by providing its address and a time range with interval options.

Instructions

Get historical APY data for a vault.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes
optionsYes

Implementation Reference

  • Handler function that performs a GraphQL query to the Morpho API to fetch historical APY and netApy data for a specific vault.
    if (name === GET_VAULT_APY_HISTORY_TOOL) { try { const { address, options } = params as VaultApyHistoryParams; const query = ` query { vaultByAddress(address: "${address}") { address historicalState { apy(options: { startTimestamp: ${options.startTimestamp} endTimestamp: ${options.endTimestamp} interval: ${options.interval} }) { x y } netApy(options: { startTimestamp: ${options.startTimestamp} endTimestamp: ${options.endTimestamp} interval: ${options.interval} }) { x y } } } }`; const response = await axios.post(MORPHO_API_BASE, { query }); const validatedData = VaultApyHistoryResponseSchema.parse(response.data); return { content: [{ type: 'text', text: JSON.stringify(validatedData.data.vaultByAddress, null, 2) }] }; } catch (error: any) { return { isError: true, content: [{ type: 'text', text: `Error retrieving vault APY history: ${error.message}` }] }; } }
  • src/index.ts:866-888 (registration)
    Tool registration in the listTools response, including name, description, and input schema definition.
    { name: GET_VAULT_APY_HISTORY_TOOL, description: 'Get historical APY data for a vault.', inputSchema: { type: 'object', properties: { address: { type: 'string' }, options: { type: 'object', properties: { startTimestamp: { type: 'number' }, endTimestamp: { type: 'number' }, interval: { type: 'string', enum: ['HOUR', 'DAY', 'WEEK', 'MONTH'] } }, required: ['startTimestamp', 'endTimestamp', 'interval'] } }, required: ['address', 'options'] } }
  • Zod schema for parsing and validating the GraphQL response containing vault historical APY data.
    const VaultApyHistoryResponseSchema = z.object({ data: z.object({ vaultByAddress: z.object({ address: z.string(), historicalState: z.object({ apy: z.array(TimeseriesPointSchema), netApy: z.array(TimeseriesPointSchema) }) }) }) });
  • TypeScript type definition for the input parameters expected by the get_vault_apy_history tool.
    type VaultApyHistoryParams = { address: string; options: { startTimestamp: number; endTimestamp: number; interval: 'HOUR' | 'DAY' | 'WEEK' | 'MONTH'; }; };
  • Constant defining the tool name for consistent reference throughout the code.
    const GET_VAULT_APY_HISTORY_TOOL = 'get_vault_apy_history';

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