Add get_concept tool for exact ID lookup#10
Merged
0xK3vin merged 1 commit into0xK3vin:mainfrom Mar 20, 2026
Merged
Conversation
- Add getConcept() handler that retrieves a concept by its exact ID using db.getNode() - Register get_concept MCP tool with Zod schema and timeline logging in index.ts - Introduce GetConceptInput type with required id field adhoc-plan-001
There was a problem hiding this comment.
Pull request overview
Adds an exact-ID retrieval path for knowledge graph concepts so agents can reliably fetch a node when they already have its concept ID (complementing understand’s semantic search).
Changes:
- Introduce
getConcepttool handler backed bydb.getNode(id)+buildNodeWithContext(). - Register new MCP tool
get_conceptwith timeline logging + error formatting. - Add dedicated
getConcepttest suite and document the new tool in the README.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Adds GetConceptInput type used by the new tool. |
| src/tools.ts | Implements getConcept exact-ID lookup returning NodeWithContext. |
| src/index.ts | Registers the get_concept MCP tool and logs it to the timeline. |
| src/tests/get-concept.test.ts | Adds coverage for success, missing ID, soft-deleted nodes, and context fields. |
| README.md | Documents get_concept and updates workflow/tool counts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+130
to
+132
| export interface GetConceptInput { | ||
| id: string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The list_roots tool returns concept IDs, and the workflow expects agents to use these IDs to navigate the graph. However, there's no way to look up a concept by its ID — the only retrieval tool is understand, which embeds the query string as a 384-dim vector and performs cosine similarity search. When an agent passes a concept ID through understand, the embedding model treats it as arbitrary text, not as a key. The resulting vector may have low similarity to the concept's own embedding, causing lookups to fail.
Motivation
My tool Fuska (https://github.com/mikaelj/fuska) stores chapter plans and task definitions as megamemory concepts with well-defined slug IDs, agents are given slugs during execution and need to retrieve the exact plan concept to follow implementation steps. Semantic search is unreliable for this — a slug like chapter-03-main-c-god-object-split embeds poorly and may not match its own concept. A direct ID lookup is the only reliable path.
Solution
Add get_concept — a lightweight exact-ID lookup tool that calls the existing db.getNode(id) and buildNodeWithContext() helpers. Returns the same NodeWithContext format as understand, with children, edges, incoming edges, and parent.
What this is
What this is not