graphiti icon indicating copy to clipboard operation
graphiti copied to clipboard

Fix: Enable custom group_id in add_episode MCP tool

Open markalosey opened this issue 8 months ago • 3 comments

Problem:

The add_episode MCP tool failed when a custom group_id string was provided, erroring with Parameter 'group_id' must be of type undefined, got string. This prevented assigning episodes to specific, non-default groups.

Solution:

This branch corrects the handling of the group_id parameter in the add_episode tool, allowing custom string group_ids to be processed successfully.

Verification:

On this branch, after restarting the server:

  1. Adding Episodes: Successfully added episodes with distinct custom group_ids (e.g., project_alpha_fix_test_001, project_beta_fix_test_002).
  2. Searching Nodes:
    • Confirmed search_nodes correctly filters by a single specified group_id.
    • Confirmed search_nodes correctly filters by a list of specified group_ids.

This validates that adding to and searching within custom groups now works as intended.

Note on Search Behavior:

Currently, search_nodes without a specified group_id defaults to the server's main group_id rather than searching all groups. This could be a future enhancement if "search all" is desired for that scenario.


[!IMPORTANT] Fixes add_episode tool to correctly handle custom group_id strings and updates related functions for default handling.

  • Behavior:
    • Fixes handling of group_id in add_episode to accept custom strings, defaulting to config.group_id if empty.
    • Updates search_nodes, search_facts, and get_episodes to handle empty group_id as default.
  • Configuration:
    • GraphitiConfig.from_cli_and_env() now sets group_id with precedence: CLI > Env Var > Default.
    • Logs group_id source in initialize_server().
  • Testing:
    • Makefile: Updates test target to load .env.test using python-dotenv.
    • pyproject.toml: Adds python-dotenv-run to dev dependencies.

This description was created by Ellipsis for 7aba34bca9e6f3428d4c7a0bf8e55713d5972ec3. You can customize this summary. It will automatically update as commits are pushed.

markalosey avatar May 13 '25 22:05 markalosey

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

danielchalef avatar May 13 '25 22:05 danielchalef

I have read the CLA Document and I hereby sign the CLA

markalosey avatar May 13 '25 23:05 markalosey

@markalosey Thank you for this contribution! Just a heads up: I won't be able to review the PR for a few weeks. Expect an early June response. Apologies in advance for the delay!

danielchalef avatar May 14 '25 15:05 danielchalef

Thanks for the contribution, are you able to resolve the conflicts?

prasmussen15 avatar Jun 13 '25 19:06 prasmussen15

I apologize for the delay. I'm just seeing this. I'll get to it this weekend

markalosey avatar Jun 14 '25 15:06 markalosey