Skip to main content
Glama
supavec

Supavec MCP Server

by supavec

fetch-embeddings

Retrieve embeddings for a file using its ID and a specific query, enabling vector search and context extraction via the Supavec MCP Server.

Instructions

Fetch embeddings for a file by ID and query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYesID of the file to get embeddings for
queryYesQuery to search for in the file

Implementation Reference

  • Executes the fetch-embeddings tool: extracts file_id and query from arguments, constructs API URL, calls makeSupavecRequest to Supavec embeddings endpoint, handles error or returns concatenated document contents as JSON text content.
    if (request.params.name === "fetch-embeddings") {
      const file_id = request.params.arguments?.file_id as string;
      const query = request.params.arguments?.query as string;
      const embeddingsUrl = `${SUPAVEC_BASE_URL}/embeddings`;
      const embeddings = await makeSupavecRequest<Embeddings>(
        embeddingsUrl,
        {
          file_ids: [file_id],
          query: query,
        },
        apiKey
      );
    
      if ("error" in embeddings) {
        return {
          content: [
            {
              type: "text",
              text: `Failed to retrieve embeddings for ${file_id}: ${embeddings.error}`,
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: "text",
            mimeType: "application/json",
            text: JSON.stringify(
              embeddings.documents.map((d) => d.content).join("\n"),
              null,
              2
            ),
          },
        ],
      };
    }
  • Registers the fetch-embeddings tool in the tools array used for listTools response, including name, description, and inputSchema.
    {
      name: "fetch-embeddings",
      description: "Fetch embeddings for a file by ID and query",
      inputSchema: {
        type: "object",
        properties: {
          file_id: {
            type: "string",
            description: "ID of the file to get embeddings for",
          },
          query: {
            type: "string",
            description: "Query to search for in the file",
          },
        },
        required: ["file_id", "query"],
      },
    },
  • Defines the JSON input schema for the fetch-embeddings tool, specifying required file_id and query parameters.
    inputSchema: {
      type: "object",
      properties: {
        file_id: {
          type: "string",
          description: "ID of the file to get embeddings for",
        },
        query: {
          type: "string",
          description: "Query to search for in the file",
        },
      },
      required: ["file_id", "query"],
    },
  • Generic utility function to make authenticated POST requests to Supavec API endpoints, used by the fetch-embeddings handler to call the embeddings endpoint.
    export async function makeSupavecRequest<T>(
      url: string,
      body: object,
      apiKey: string
    ): Promise<T | { error: string }> {
      try {
        const response = await fetch(url, {
          method: "POST",
          headers: {
            authorization: apiKey,
            "Content-Type": "application/json",
          },
          body: JSON.stringify(body),
        });
        if (!response.ok) {
          return {
            error: `Failed to fetch data: status ${response.status}`,
          };
        }
    
        const data = await response.json();
        return data as T;
      } catch (error) {
        return {
          error: `Failed to fetch data: ${error}`,
        };
      }
    }
  • TypeScript type definition for the Embeddings response from the Supavec API, used in the handler.
    export type Embeddings = {
      documents: {
        content: string;
      }[];
    };
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 the tool fetches embeddings but doesn't describe what 'embeddings' are in this context, how they are returned, any rate limits, authentication needs, or potential side effects. This leaves significant gaps for an AI agent to understand the tool's behavior.

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 directly states the tool's purpose without any wasted words. It is front-loaded and appropriately sized for the tool's complexity.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'embeddings' are, how they are structured, or what the return values look like, which is crucial for a tool with undefined outputs and behavioral traits. The description should provide more context to compensate for the lack of structured data.

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%, with clear descriptions for both parameters ('file_id' and 'query'), so the schema does the heavy lifting. The description adds no additional meaning beyond what the schema provides, such as format details or usage examples, but this is acceptable given the high schema coverage.

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 ('fetch embeddings') and the target resource ('for a file by ID and query'), which is specific and unambiguous. However, it doesn't explicitly differentiate from the sibling tool 'list-user-files', which appears to list files rather than fetch embeddings, so it misses full sibling distinction.

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, such as the sibling 'list-user-files', or any context about prerequisites, scenarios, or exclusions. It merely restates the basic functionality without usage context.

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/supavec/mcp-server'

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