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
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes | ID 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); } } ); - src/index.ts:1715-1717 (schema)Input schema definition for vectorizeFile - accepts a file_id string parameter
{ file_id: z.string().describe("ID of the file to vectorize"), },