Skip to main content
Glama

queryVectors

Search vectorized files in a group using semantic queries to find relevant content based on meaning rather than keywords.

Instructions

Query vectorized files in a group using semantic search

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_idYesID of the group to search
textYesQuery string for semantic search

Implementation Reference

  • src/index.ts:1785-1815 (registration)
    Registration of the queryVectors tool with the MCP server. This defines the tool name, description, input schema (group_id and text parameters), and the async handler function that executes the semantic search query against vectorized files in a Pinata group.
    server.tool(
      "queryVectors",
      "Query vectorized files in a group using semantic search",
      {
        group_id: z.string().describe("ID of the group to search"),
        text: z.string().describe("Query string for semantic search"),
      },
      async ({ group_id, text }) => {
        try {
          const url = `https://uploads.pinata.cloud/v3/vectorize/groups/${group_id}/query`;
    
          const response = await fetch(url, {
            method: "POST",
            headers: getHeaders(),
            body: JSON.stringify({ text }),
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(
              `Failed to query vectors: ${response.status} ${response.statusText}\n${errorText}`
            );
          }
    
          const data = await response.json();
          return successResponse(data);
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • Handler implementation for queryVectors tool. Makes a POST request to Pinata's vectorize API endpoint (https://uploads.pinata.cloud/v3/vectorize/groups/{group_id}/query) with the search text, handles errors, and returns the response data using successResponse helper.
    server.tool(
      "queryVectors",
      "Query vectorized files in a group using semantic search",
      {
        group_id: z.string().describe("ID of the group to search"),
        text: z.string().describe("Query string for semantic search"),
      },
      async ({ group_id, text }) => {
        try {
          const url = `https://uploads.pinata.cloud/v3/vectorize/groups/${group_id}/query`;
    
          const response = await fetch(url, {
            method: "POST",
            headers: getHeaders(),
            body: JSON.stringify({ text }),
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(
              `Failed to query vectors: ${response.status} ${response.statusText}\n${errorText}`
            );
          }
    
          const data = await response.json();
          return successResponse(data);
        } catch (error) {
          return errorResponse(error);
        }
      }
    );

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/PinataCloud/pinata-mcp'

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