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
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | Yes | ID of the group to search | |
| text | Yes | Query 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); } } ); - src/index.ts:1785-1815 (handler)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); } } );