search_pgvector
Convert a natural language query into an embedding and search PostgreSQL pgvector tables by cosine distance, returning ranked document chunks with similarity scores for RAG.
Instructions
Semantic search across a PostgreSQL pgvector table using cosine distance. Takes a natural language query, generates an embedding, and returns the most similar document chunks with similarity scores. Use list_postgres_tables with vector_only=true to discover available pgvector tables. For RAG: pass the returned text to ai_answer.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "search_pgvector"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural language search query | |
| table | No | Table name (default: documents) | |
| top_k | No | Number of results to return (default: 5) | |
| schema | No | PostgreSQL schema (default: public) |