Skip to main content
Glama
GrafeoDB

grafeo-mcp

Official
by GrafeoDB

mmr_search

Find diverse nearest neighbors by balancing relevance and diversity, reducing redundant results. Ideal for RAG pipelines needing broad coverage.

Instructions

Find diverse nearest neighbors using Maximal Marginal Relevance (MMR).

MMR balances relevance to the query with diversity among results, avoiding redundant near-duplicate results. This is ideal for RAG pipelines where you want broad coverage rather than 10 variations of the same paragraph.

Use this tool when: you need diverse vector search results for RAG or when vector_search returns too many near-duplicates. Use vector_search when: you want the absolute closest matches regardless of diversity.

Args: label: Node label to search within (e.g. "Document"). property: Property that holds the embedding vector (e.g. "embedding"). query_vector: The query embedding as a list of floats. k: Number of diverse results to return (default 10). fetch_k: Initial candidates from HNSW before MMR re-ranking (default: 4*k). Higher values give MMR more to choose from. lambda_mult: Balance between relevance and diversity. 0.0 = maximize diversity, 1.0 = maximize relevance. Default: 0.5 (balanced). For RAG, try 0.3-0.7. ef: HNSW search beam width. Leave as None for index default.

Returns: JSON array of {node_id, distance, labels, properties} ordered by MMR selection (not pure distance).

Example call: mmr_search("Document", "embedding", [0.12, -0.34, ...], k=5, lambda_mult=0.3)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelYes
propertyYes
query_vectorYes
kNo
fetch_kNo
lambda_multNo
efNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations present, so description fully carries the burden. It details the MMR algorithm's balancing of relevance and diversity, explains the effect of lambda_mult, fetch_k, and ef, and notes that results are ordered by MMR selection, not pure distance.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with intro, usage advice, parameter details, return description, and example. Very informative, though slightly verbose in parameter explanations; still earns its length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers all necessary aspects: algorithm behavior, parameter roles, return format (JSON array of objects with fields), and example invocation. Output schema exists, so return details are sufficient. Complements sibling tools like vector_search.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description comprehensively explains each parameter: label/property/query_vector (required), k, fetch_k (with default derivation from k), lambda_mult (with recommended range for RAG), and ef. Adds context like default values and tuning advice.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource ('Find diverse nearest neighbors using MMR') and explicitly distinguishes from sibling tool 'vector_search' by contrasting use cases ('Use this tool when... Use vector_search when...').

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear 'when to use' (diverse results for RAG, avoiding near-duplicates) and 'when not to use' (use vector_search for absolute closest matches), with explicit alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/GrafeoDB/grafeo-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server