Skip to main content
Glama

search_vaults

Search and filter DeFi vaults by chain, protocol, asset, risk tier, TVL, and other criteria. Get paginated results with risk scores and APR data for due diligence.

Instructions

Search and filter DeFi vaults by chain, protocol, asset, risk tier, TVL, and more. Returns a paginated list with risk scores and APR.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSearch by vault name, symbol, asset, protocol, or curator
chainNoFilter by chain name (e.g. Ethereum, Base, Arbitrum)
protocolNoFilter by protocol ID (e.g. morpho, aave-v3, yearn-v3)
assetNoFilter by asset symbol (e.g. USDC, WETH)
riskTierNoFilter by risk tier: Prime, Core, or Edge
minTvlNoMinimum TVL in USD
sortByNoSort field: tvl_usd, apr_net, name, last_synced_at
sortOrderNoSort order: asc or desc
limitNoMax results (default 10, max 50)

Implementation Reference

  • Main implementation of search_vaults tool. Contains the registerSearchVaults function that defines the tool schema (lines 10-26) and the async handler (lines 27-58) which builds query parameters, calls the API, and formats the results for display.
    export function registerSearchVaults(server: McpServer) {
      server.tool(
        'search_vaults',
        'Search and filter DeFi vaults by chain, protocol, asset, risk tier, TVL, and more. Returns a paginated list with risk scores and APR.',
        {
          query: z
            .string()
            .optional()
            .describe('Search by vault name, symbol, asset, protocol, or curator'),
          chain: z.string().optional().describe('Filter by chain name (e.g. Ethereum, Base, Arbitrum)'),
          protocol: z
            .string()
            .optional()
            .describe('Filter by protocol ID (e.g. morpho, aave-v3, yearn-v3)'),
          asset: z.string().optional().describe('Filter by asset symbol (e.g. USDC, WETH)'),
          riskTier: z.string().optional().describe('Filter by risk tier: Prime, Core, or Edge'),
          minTvl: z.number().optional().describe('Minimum TVL in USD'),
          sortBy: z.string().optional().describe('Sort field: tvl_usd, apr_net, name, last_synced_at'),
          sortOrder: z.string().optional().describe('Sort order: asc or desc'),
          limit: z.number().optional().describe('Max results (default 10, max 50)'),
        },
        async (params) => {
          const qs = buildQueryString({
            search: params.query,
            chain: params.chain,
            protocol: params.protocol,
            asset: params.asset,
            riskTier: params.riskTier,
            minTvl: params.minTvl,
            sortBy: params.sortBy || 'tvl_usd',
            sortOrder: params.sortOrder || 'desc',
            limit: Math.min(params.limit || 10, 50),
            page: 1,
          });
    
          const result = await apiGet<{ data: any[]; meta: any }>(`/v1/vaults${qs}`);
          const vaults = result.data;
    
          if (!vaults.length) {
            return {
              content: [
                { type: 'text' as const, text: 'No vaults found matching the given criteria.' },
              ],
            };
          }
    
          const lines = vaults.map((v) => formatVaultSummary(v));
          const summary =
            `Found ${result.meta.total} vaults (showing ${vaults.length}):\n\n` +
            lines.join('\n\n---\n\n');
    
          return { content: [{ type: 'text' as const, text: summary }] };
        }
      );
    }
  • src/server.ts:31-31 (registration)
    Tool registration - the search_vaults tool is registered with the MCP server by calling registerSearchVaults(server).
    registerSearchVaults(server);
  • Helper function buildQueryString that converts an object of parameters into a URL query string, used by search_vaults to construct API request parameters.
    export function buildQueryString(
      params: Record<string, string | number | boolean | undefined>
    ): string {
      const sp = new URLSearchParams();
      for (const [key, value] of Object.entries(params)) {
        if (value !== undefined && value !== false) sp.set(key, String(value));
      }
      const str = sp.toString();
      return str ? `?${str}` : '';
    }
  • Helper function apiGet that makes HTTP GET requests to the Philidor API endpoint, used by search_vaults to fetch vault data from /v1/vaults.
    export async function apiGet<T = any>(path: string): Promise<T> {
      const res = await fetch(`${API_BASE}${path}`, {
        headers: { Accept: 'application/json' },
      });
      if (!res.ok) {
        let message: string;
        try {
          const json = (await res.json()) as Record<string, any>;
          message = json?.error?.message || json?.message || JSON.stringify(json);
        } catch {
          message = res.statusText || `HTTP ${res.status}`;
        }
        throw new Error(`API ${res.status}: ${message}`);
      }
      const json = await res.json();
      return json as T;
    }
  • Helper function formatVaultSummary that formats a single vault object into a human-readable markdown summary with protocol, chain, asset, TVL, APR, and risk score information.
    export function formatVaultSummary(vault: any): string {
      const rs = vault.risk_score;
      const riskTier =
        vault.risk_tier ||
        (rs != null && rs >= 8
          ? 'Prime'
          : rs != null && rs >= 5
            ? 'Core'
            : rs != null
              ? 'Edge'
              : 'N/A');
      const score = vault.total_score ?? vault.risk_score ?? 'N/A';
      return [
        `## ${vault.name}`,
        `**Protocol:** ${vault.protocol_name} | **Chain:** ${vault.chain_name} | **Asset:** ${vault.asset_symbol || 'N/A'}`,
        `**TVL:** $${formatNumber(vault.tvl_usd)} | **APR:** ${formatPercent(vault.apr_net)}`,
        `**Risk Score:** ${score}/10 (${riskTier})`,
        vault.curator_name ? `**Curator:** ${vault.curator_name}` : null,
      ]
        .filter(Boolean)
        .join('\n');
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It usefully adds that the tool returns a 'paginated list with risk scores and APR', which goes beyond the input schema. However, it does not cover important aspects like rate limits, authentication needs, error conditions, or whether the search is real-time or cached, leaving gaps for a tool with 9 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 front-loaded and efficiently structured in a single sentence, clearly stating the action, filterable attributes, and return format. Every word earns its place without redundancy, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's complexity (9 parameters, no annotations, no output schema), the description is moderately complete. It covers the core purpose and return format but lacks details on behavioral traits (e.g., rate limits, auth), error handling, and output structure beyond 'paginated list with risk scores and APR'. For a search tool with rich filtering, more context would be beneficial.

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

Parameters3/5

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

The schema description coverage is 100%, so the schema already documents all 9 parameters thoroughly. The description adds marginal value by listing some filter criteria ('chain, protocol, asset, risk tier, TVL') and mentioning 'and more', but does not provide additional syntax, format details, or constraints beyond what the schema specifies. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('search and filter') and resources ('DeFi vaults'), listing multiple filter criteria. It distinguishes itself from siblings like 'get_vault' (single vault) and 'find_safest_vaults' (specific risk focus) by emphasizing comprehensive search capabilities.

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

Usage Guidelines3/5

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

The description implies usage context through the listed filter criteria (e.g., 'by chain, protocol, asset, risk tier'), suggesting when to use it for multi-criteria searches. However, it lacks explicit guidance on when to choose this tool over alternatives like 'find_safest_vaults' or 'get_market_overview', and does not mention exclusions or prerequisites.

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

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/Philidor-Labs/philidor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server