Skip to main content
Glama
crazyrabbitLTC

Morpho API MCP Server

get_vault_allocation

Retrieve vault allocation for a specific market by providing the address and chain ID using the Morpho API MCP Server.

Instructions

Get vault allocation for a specific market.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes
chainIdNo

Implementation Reference

  • The core handler logic for the 'get_vault_allocation' tool. It takes vault address and optional chainId, constructs a GraphQL query to fetch vault state allocation from Morpho API, validates the response using Zod schema, and returns the formatted data.
    if (name === GET_VAULT_ALLOCATION_TOOL) {
        try {
              const { address, chainId = 1 } = params as VaultAllocationParams;
              const query = `
              query {
                vaultByAddress(
                  chainId: ${chainId}
                  address: "${address}"
                ) {
                  address
                  state {
                    allocation {
                      market {
                        uniqueKey
                      }
                      supplyCap
                      supplyAssets
                      supplyAssetsUsd
                    }
                  }
                }
              }`;
    
              const response = await axios.post(MORPHO_API_BASE, { query });
              const validatedData = VaultAllocationResponseSchema.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 allocation: ${error.message}` }],
              };
        }
    }
  • src/index.ts:767-778 (registration)
    Registration of the tool in the listTools handler, providing name, description, and JSON input schema for the MCP protocol.
    {
      name: GET_VAULT_ALLOCATION_TOOL,
      description: 'Get vault allocation for a specific market.',
      inputSchema: {
        type: 'object',
        properties: {
          address: { type: 'string' },
          chainId: { type: 'number' }
        },
        required: ['address']
      },
    },
  • Zod schema used to validate the GraphQL response data for vault allocation in the tool handler.
    const VaultAllocationResponseSchema = z.object({
      data: z.object({
        vaultByAddress: z.object({
          address: z.string(),
          state: z.object({
            allocation: z.array(VaultAllocationSchema)
          })
        })
      })
    });
  • TypeScript type definition for the input parameters expected by the tool handler.
    type VaultAllocationParams = {
      address: string;
      chainId?: number;
    };
  • src/index.ts:472-472 (registration)
    Constant defining the tool name string.
    const GET_VAULT_ALLOCATION_TOOL = 'get_vault_allocation';
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. It states a read operation ('Get'), implying it's likely safe, but doesn't disclose any behavioral traits such as rate limits, authentication needs, error conditions, or what the return format might be. This leaves significant gaps for a tool with parameters.

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, clear sentence with zero waste. It's appropriately sized and front-loaded, making it easy to parse without unnecessary elaboration.

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 (2 parameters, 0% schema coverage, no annotations, no output schema), the description is incomplete. It doesn't explain the parameters, return values, or behavioral aspects, making it inadequate for reliable tool invocation in this context.

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 schema provides no parameter details. The description mentions 'for a specific market', which hints at the 'address' parameter but doesn't explain what 'address' or 'chainId' mean, their formats, or how they relate to the market. It adds minimal value beyond the 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 action ('Get') and resource ('vault allocation for a specific market'), making the purpose understandable. However, it doesn't distinguish this tool from siblings like 'get_vaults' or 'get_vault_positions', which might also relate to vaults, so it lacks explicit differentiation.

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 siblings like 'get_vaults' and 'get_vault_positions', there's no indication of context or prerequisites, leaving the agent to guess based on tool 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