Skip to main content
Glama

vectorizeFile

Convert files into vector embeddings to enable AI-powered semantic search and content analysis.

Instructions

Vectorize a file for AI/semantic search capabilities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYesID of the file to vectorize

Implementation Reference

  • src/index.ts:1712-1747 (registration)
    Registration and handler for the vectorizeFile tool - makes a POST request to Pinata's vectorize API to enable AI/semantic search on a file
    server.tool(
      "vectorizeFile",
      "Vectorize a file for AI/semantic search capabilities",
      {
        file_id: z.string().describe("ID of the file to vectorize"),
      },
      async ({ file_id }) => {
        try {
          const url = `https://uploads.pinata.cloud/v3/vectorize/files/${file_id}`;
    
          const response = await fetch(url, {
            method: "POST",
            headers: getHeaders(),
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(
              `Failed to vectorize file: ${response.status} ${response.statusText}\n${errorText}`
            );
          }
    
          const data = await response.json();
          return {
            content: [
              {
                type: "text",
                text: `✅ File vectorized successfully!\n\n${JSON.stringify(data, null, 2)}`,
              },
            ],
          };
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • Input schema definition for vectorizeFile - accepts a file_id string parameter
    {
      file_id: z.string().describe("ID of the file to vectorize"),
    },

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