Skip to main content
Glama
crazyrabbitLTC

Morpho API MCP Server

get_vaults

Retrieve detailed information on all vaults including their current states, sorted and filtered by assets, APY, or net APY in ascending or descending order.

Instructions

Retrieves all vaults with their current states.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNo
orderByNo
orderDirectionNo
skipNo

Implementation Reference

  • src/index.ts:800-818 (registration)
    Registration of the 'get_vaults' tool in the listTools handler, including input schema definition.
    {
      name: GET_VAULTS_TOOL,
      description: 'Retrieves all vaults with their current states.',
      inputSchema: {
        type: 'object',
        properties: {
          first: { type: 'number' },
          skip: { type: 'number' },
          orderBy: {
            type: 'string',
            enum: ['TotalAssetsUsd', 'Apy', 'NetApy']
          },
          orderDirection: {
            type: 'string',
            enum: ['Asc', 'Desc']
          }
        }
      }
    },
  • Handler function for 'get_vaults' tool that constructs a GraphQL query to fetch vaults data from Morpho API, validates the response using VaultsResponseSchema, and returns formatted JSON.
    if (name === GET_VAULTS_TOOL) {
      try {
        const queryParams = buildQueryParams(params as VaultQueryParams);
        const query = `
          query {
            vaults${queryParams} {
              pageInfo {
                count
                countTotal
              }
              items {
                address
                symbol
                name
                creationBlockNumber
                creationTimestamp
                creatorAddress
                whitelisted
                asset {
                  id
                  address
                  decimals
                }
                chain {
                  id
                  network
                }
                state {
                  id
                  apy
                  netApy
                  totalAssets
                  totalAssetsUsd
                  fee
                  timelock
                }
                warnings {
                  type
                  level
                }
              }
            }
          }`;
    
        const response = await axios.post(MORPHO_API_BASE, { query });
        const validatedData = VaultsResponseSchema.parse(response.data);
    
        return {
          content: [{ type: 'text', text: JSON.stringify(validatedData.data.vaults, null, 2) }]
        };
      } catch (error: any) {
        return {
          isError: true,
          content: [{ type: 'text', text: `Error retrieving vaults: ${error.message}` }]
        };
      }
    }
  • Zod schema for validating the response from the Morpho API vaults query.
    const VaultsResponseSchema = z.object({
      data: z.object({
        vaults: z.object({
          pageInfo: PageInfoSchema,
          items: z.array(VaultSchema)
        })
      })
    });
  • Detailed Zod schema defining the structure of a single vault object used in response validation.
    const VaultSchema = z.object({
      address: z.string(),
      symbol: z.string(),
      name: z.string(),
      creationBlockNumber: z.number(),
      creationTimestamp: z.number(),
      creatorAddress: z.string(),
      whitelisted: z.boolean(),
      asset: z.object({
        id: z.string(),
        address: z.string(),
        decimals: z.number()
      }),
      chain: z.object({
        id: z.number(),
        network: z.string()
      }),
      state: z.object({
        id: z.string(),
        apy: z.number().nullable(),
        netApy: z.number().nullable(),
        totalAssets: z.union([z.string(), z.number()]).transform(stringToNumber),
        totalAssetsUsd: z.union([z.string(), z.number(), z.null()]).transform(val => val === null ? 0 : stringToNumber(val)),
        fee: z.number(),
        timelock: z.number()
      }),
      warnings: z.array(WarningSchema).optional(),
      pendingCaps: z.array(PendingCapSchema).optional(),
      allocators: z.array(z.object({
        address: z.string()
      })).optional(),
      publicAllocatorConfig: PublicAllocatorConfigSchema.optional()
    });
  • Constant defining the tool name 'get_vaults' for use in registration and handler dispatch.
    const GET_VAULTS_TOOL = 'get_vaults';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'retrieves' data, implying a read-only operation, but doesn't mention any behavioral traits such as pagination (suggested by 'first' and 'skip' parameters), rate limits, authentication needs, or what 'current states' entails. This leaves significant gaps for safe and effective use.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part earns its place by directly stating what the tool does, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of 4 parameters with 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain parameter usage, return values, or behavioral constraints, leaving the agent with insufficient information to use the tool correctly in context with its siblings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'all vaults' but doesn't explain the four parameters (first, orderBy, orderDirection, skip), their purposes, or how they affect retrieval (e.g., pagination, sorting). This fails to add meaningful context beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Retrieves' and the resource 'all vaults with their current states', which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_vault_positions' or 'get_vault_allocation', which might also retrieve vault-related data but with different scopes or details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools like 'get_vault_positions' or 'get_vault_allocation', there's no indication of what makes this tool unique or when it's the appropriate choice, leaving the agent to guess based on names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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