Skip to content

feat: add search_entity_labels tool for fuzzy entity search#7

Open
magnus919 wants to merge 1 commit into
desimpkins:mainfrom
magnus919:feature/search-entity-labels
Open

feat: add search_entity_labels tool for fuzzy entity search#7
magnus919 wants to merge 1 commit into
desimpkins:mainfrom
magnus919:feature/search-entity-labels

Conversation

@magnus919
Copy link
Copy Markdown

Summary

  • Adds search_entity_labels MCP tool wrapping /graph/label/search
  • Accepts a list of queries so agents can batch-check multiple entities in one call instead of N round trips
  • Returns fuzzy-matched entity names per query; empty list when no match
  • Validated against a live instance with 32,000+ entities

Interface

search_entity_labels(queries: ["Brynjolfsson", "Generative AI"], limit: 5)
{
  "results": [
    {"query": "Brynjolfsson", "matches": ["Brynjolfsson", "Brynjolfsson And Mitchell", ...]},
    {"query": "Generative AI", "matches": ["Generative AI", "Generative Ai", ...]}
  ]
}

Note on degree

The /graph/label/search endpoint returns entity names only — degree is not part of the response. The min_degree filter proposed in the issue cannot be implemented without additional per-entity lookups, which would be expensive at scale. Entity names alone are sufficient for the primary use cases (pre-query confirmation, post-insert verification, canonical name lookup).

Closes #5

Test plan

  • Call with a single query string and confirm matches returned
  • Call with multiple queries and confirm one result entry per query
  • Call with a query that matches nothing and confirm matches: []
  • Call with limit and confirm result count is capped

🤖 Generated with Claude Code

Wraps /graph/label/search to support batch queries — multiple search
terms in one call, each returning a list of fuzzy-matched entity names.
Useful for pre-query entity confirmation, post-insert verification, and
finding canonical entity names before graph traversal.

Note: LightRAG's search endpoint returns names only; degree is not
available from this endpoint.

Closes desimpkins#5

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: search_entity_labels — fuzzy entity search with degree

1 participant