This is NOT an MCP server. The repository contains a SQL function definition file (01-RAG-Supabase/function_match_documents.sql) that defines a PostgreSQL database function for vector similarity search. There is no MCP server implementation, no transport layer, no tool registration mechanism, and no protocol compliance. The tool definition appears to be inferred from SQL function metadata rather than being explicitly registered in an MCP-compliant tool schema. The input/output are raw SQL structures, not JSON Schema-compliant MCP tool definitions. This scores extremely low because: (1) no tool registration is visible in source code; (2) no JSON Schema input definitions exist; (3) descriptions are minimal; (4) no error handling for LLM consumption; (5) no security considerations for agent use.
Tools (1)
match_documentsread onlyauth18/100
Vector similarity search function that matches documents based on embedding similarity
Not an MCP server. No MCP protocol implementation detected. Source is a raw SQL function file with no tool registration, no MCP transport, and no schema compliance.
No JSON Schema input definitions. Tool input parameters (filter, match_count, query_embedding) are not formally defined as JSON Schema objects with type constraints, descriptions, or validation rules. The schema score is 0.
Tool description is too generic and under 20 characters of meaningful context. 'Vector similarity search function that matches documents based on embedding similarity' lacks WHEN to use it, WHAT it returns in detail, and prerequisites. Fails the 10-1024 character range guideline.
No parameter descriptions. The 'filter' parameter lacks explanation (what JSONB structure is expected?). The 'query_embedding' parameter type 'vector' is not a standard JSON Schema type and is not described. LLMs cannot infer what values are valid.
Recommendations
Do NOT use this SQL function directly as an MCP tool. This is a database function, not an agent-facing tool. Build an MCP server wrapper that calls this function and exposes it via proper JSON Schema and MCP protocol.
Create a proper MCP server (in Python, Node.js, or Go) that wraps the match_documents SQL function and registers it as an MCP Tool with name 'search_documents_by_similarity', a 100-150 character description, and formal JSON Schema input/output.
Add comprehensive input schema: 'filter' must be described as a JSONB object with its expected structure (e.g., field:value pairs for column filtering); 'match_count' must be constrained to an integer in range 1-100; 'query_embedding' must describe the vector format (dimension, float precision, normalization).
Expand the tool description to 100-200 characters explaining: (1) what it does (find documents similar to an embedding), (2) WHEN to call it (after generating a query embedding), (3) WHAT it returns (array of {id, content, metadata, similarity}), (4) any prerequisites (table 'rag' must exist with 'embedding' column).
Add detailed parameter descriptions: 'filter: JSONB object with optional column:value constraints to narrow search results (e.g., {"category": "technical"}). Leave empty {} for no filtering.', 'match_count: Maximum number of similar documents to return (1-100; default 10).', 'query_embedding: Vector embedding array (float32 or float64, must match table column dimension). Generated by your embedding model.'
Document the output schema: Return array of objects with {id: bigint, content: string, metadata: jsonb, similarity: float (0-1 scale where 1 is exact match)}. Explain that results are ordered by descending similarity.
Output schema not documented for LLM consumption. The SQL RETURNS clause defines (id, content, metadata, similarity) but there is no LLM-facing schema documentation explaining what these fields contain, their types, or when they are populated.
No error handling guidance for LLMs. The SQL function does not define what happens on invalid filter syntax, missing table, or embedding dimension mismatch. No recovery messages or categorization (retryable vs fatal).
Naming is not verb-based. 'match_documents' is a noun phrase. Better names would be 'search_documents_by_similarity' or 'find_similar_documents' to make the action explicit.
No pagination support declared. The tool accepts 'match_count' but does not document offset/limit pagination, total count, or how results are ordered beyond embedding distance.
SQL injection risk exposed via JSONB filter parameter. The filter is passed directly to a WHERE clause without sanitization documentation or LLM guidance on safe filter construction.
No security documentation. No mention of permissions required, who can call this function, rate limits, or audit logging.
match_documents
Add error handling: 'If query_embedding dimension does not match table embeddings, the function will fail with a database error. Ensure query and table embeddings are generated by the same model with the same dimension.' Also document what happens if the 'rag' table does not exist.
Add security guidance: Document required permissions (SELECT on rag table, EXECUTE on match_documents function). Add rate limiting guidance if called from agents (e.g., max 100 queries/minute).
Sanitize the JSONB filter parameter. In the MCP server wrapper, validate that the filter JSON conforms to an expected schema before passing to SQL to prevent injection attacks.
Return paginated results if the agent might request many matches. Add optional 'offset' parameter (default 0) and document that results are always ordered by similarity score descending.
Add a separate discovery tool (e.g., 'describe_document_collection') that returns the table schema, embedding dimension, available metadata fields, and example documents. This helps agents understand what they're searching.