Skip to main content
Glama

get_vault_transactions

Retrieve and filter vault transactions by type, order, and pagination to track deposits, withdrawals, and fees efficiently.

Instructions

Get latest vault transactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNo
orderByNo
orderDirectionNo
skipNo
type_inNo

Implementation Reference

  • Handler function that executes the get_vault_transactions tool: parses params, builds GraphQL query for transactions (filtered by type if provided), calls Morpho API, validates response with Zod schema, returns JSON or error.
    if (name === GET_VAULT_TRANSACTIONS_TOOL) { try { const { type_in, ...rest } = params as VaultTransactionsParams; const queryParams = buildQueryParams({ ...rest, where: { type_in } }); const query = ` query { transactions${queryParams} { items { hash timestamp type chain { id network } user { address } data { ... on VaultTransactionData { shares assets vault { address } } } } } }`; const response = await axios.post(MORPHO_API_BASE, { query }); const validatedData = VaultTransactionsResponseSchema.parse(response.data); return { content: [{ type: 'text', text: JSON.stringify(validatedData.data.transactions, null, 2) }] }; } catch (error: any) { return { isError: true, content: [{ type: 'text', text: `Error retrieving vault transactions: ${error.message}` }] }; }
  • Zod schema for parsing and validating the GraphQL response data from the vault transactions query.
    const VaultTransactionsResponseSchema = z.object({ data: z.object({ transactions: z.object({ items: z.array(z.object({ hash: z.string(), timestamp: z.number(), type: z.string(), chain: z.object({ id: z.number(), network: z.string() }), user: z.object({ address: z.string() }), data: z.object({ shares: z.union([z.string(), z.number()]).transform(stringToNumber).optional(), assets: z.union([z.string(), z.number()]).transform(stringToNumber).optional(), vault: z.object({ address: z.string() }).optional() }).optional() })) }) }) });
  • src/index.ts:840-865 (registration)
    Tool registration in the listTools handler: defines name, description, and JSON input schema for parameters (pagination, ordering, type filter).
    { name: GET_VAULT_TRANSACTIONS_TOOL, description: 'Get latest vault transactions.', inputSchema: { type: 'object', properties: { first: { type: 'number' }, skip: { type: 'number' }, orderBy: { type: 'string', enum: ['Timestamp'] }, orderDirection: { type: 'string', enum: ['Asc', 'Desc'] }, type_in: { type: 'array', items: { type: 'string', enum: ['MetaMorphoFee', 'MetaMorphoWithdraw', 'MetaMorphoDeposit'] } } } } },
  • TypeScript type definition for the input parameters of the get_vault_transactions tool.
    type VaultTransactionsParams = PaginationParams & { orderBy?: 'Timestamp'; orderDirection?: OrderDirection; type_in?: ('MetaMorphoFee' | 'MetaMorphoWithdraw' | 'MetaMorphoDeposit')[]; };
  • src/index.ts:490-490 (registration)
    Constant defining the tool name string for consistent reference.
    const GET_VAULT_TRANSACTIONS_TOOL = 'get_vault_transactions';

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