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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_vault_transactions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| first | No | ||
| orderBy | No | ||
| orderDirection | No | ||
| skip | No | ||
| type_in | No |
Implementation Reference
- src/index.ts:1544-1590 (handler)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}` }] }; } - src/index.ts:540-564 (schema)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'] } } } } }, - src/index.ts:509-513 (schema)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';