Skip to content

fix(serve): show community name in get_community MCP output#1448

Closed
rmart1308 wants to merge 2 commits into
Graphify-Labs:v8from
rmart1308:fix/get-community-name
Closed

fix(serve): show community name in get_community MCP output#1448
rmart1308 wants to merge 2 commits into
Graphify-Labs:v8from
rmart1308:fix/get-community-name

Conversation

@rmart1308

Copy link
Copy Markdown
Contributor

What

get_community was the only MCP graph query tool still returning a bare numeric
community id. get_node (and the query-traversal output in _subgraph_to_text)
already read the community_name node attribute that to_json writes onto every
node, so an agent that had located a community by name — via GRAPH_REPORT.md,
get_node, or query output — had no way to confirm it through get_community.

This makes get_community consistent with the rest of the serve layer: it reads
the name from the community's member nodes (they all share it) and formats it into
the header, e.g.

Community 12 — Auth & Sessions (8 nodes):
  login() [auth/router.py]
  ...

It falls back to the bare id for graphs built before community_name was
persisted, and routes the value through sanitize_label like every other
LLM-derived field (F-010).

Why

Small consistency/UX gap. Once you can see community names everywhere else, the
one tool whose whole job is "show me this community" shouldn't be the one that
hides them behind a number.

Notes

  • Follows the existing get_node precedent (inline read of community_name), so
    no new test was added — the tool closures aren't unit-tested directly in
    tests/test_serve.py, and the community_name attribute itself is produced and
    tested in the to_json / export path. Happy to extract a small module-level
    formatter and add a focused test if you'd prefer the change be directly covered.
  • CHANGELOG Unreleased entry uses a (#XXXX) placeholder — replace with the PR
    number on merge.

🤖 Generated with Claude Code

rmart1308 and others added 2 commits June 24, 2026 09:59
get_community was the only graph query tool still returning a bare
numeric community id. get_node and the query-traversal output already
read the community_name node attribute that to_json writes onto every
node, so an agent that located a community by name elsewhere (the
report, get_node, or query output) had no way to confirm it here.

Read the name from the community's member nodes (they all share it) and
format it into the header, e.g. "Community 12 — Auth & Sessions (8
nodes)". Falls back to the bare id for graphs built before
community_name was persisted, and routes the value through
sanitize_label like every other LLM-derived field.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rmart1308 rmart1308 changed the base branch from main to v8 June 24, 2026 10:44
safishamsi pushed a commit that referenced this pull request Jun 24, 2026
get_community was the only graph tool still returning a bare numeric id, while
get_node and the query-traversal output already render the community_name
attribute to_json writes onto every node. Read the name from the community's
member nodes and put it in the header ("Community 12 — Auth & Sessions"),
sanitised like every other LLM-derived field.

Ported from PR #1448 by @rmart1308 onto current v8, with two additions: the name
is skipped when it is just the "Community N" placeholder (written for unnamed
communities) so the header never doubles to "Community 12 — Community 12", and
the formatting is extracted to a module-level _community_header() with focused
tests (named / placeholder / empty / sanitised). Full suite 2397 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@safishamsi

Copy link
Copy Markdown
Collaborator

Landed on v8 (commit f9ded63), authored to you. I added two things on top of your change: the name is skipped when it is only the Community N placeholder (written for unnamed communities), so the header doesn't read Community 12 — Community 12; and I pulled the formatting into a small module-level _community_header() with focused tests (named / placeholder / empty / sanitised), which also answers your note about the tool closures not being directly testable. Verified: serve/MCP suite green, full suite 2397 passed. Thanks for spotting the consistency gap and for the clean writeup. Closing as landed.

@safishamsi safishamsi closed this Jun 24, 2026
safishamsi added a commit that referenced this pull request Jun 25, 2026
get_community shows the community name (#1448); starlette floored >=1.3.1 for
CVE-2026-48818 / CVE-2026-54283 (#1391, #1396); begin per-language extractor
split into graphify/extractors/ (#1212); parallel community labeling via
--max-concurrency / --batch-size (#1390); reflect dedups dead-ends/corrections;
and the work-memory loop no longer depends on the git hook (reflect --if-stale).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
berezinan added a commit to berezinan/graphity that referenced this pull request Jun 25, 2026
…cadeDB fork

Brings the latest upstream graphify (trigram query prefilter, PDF/text
slicing Graphify-Labs#1369/Graphify-Labs#1386, extractor plugin layer, build-from-json hardening,
F-010 sanitization, dependency pins) on top of our 1C/BSL + ArcadeDB-backend
branch and the four feature commits (tiered file caps, viz scaling, global
ignore, graphity alias).

Conflict resolutions:
- detect.py: union CODE_EXTENSIONS — keep upstream .cu/.cuh + our 1C exts.
- llm.py: keep upstream Path-normalization line + our _TEXT_SLICE_CHARS
  (our tiered-cap rename of _FILE_CHAR_CAP).
- serve.py: keep our query_backend abstraction (JSON/ArcadeDB selection,
  render_* delegation) and graft upstream's trigram prefilter into the
  in-memory scan via _score_terms; eager trigram index built only on the
  JSON path; community render keeps our render_community.
- query_backend.py: restore upstream's Graphify-Labs#1448 community-name display
  ("Community N — Name") inside our render_community / CommunityRecord, which
  the serve.py block-4 resolution would otherwise have dropped. F-010
  sanitization stays centralized here.
- pyproject.toml: keep our arcadedb extra + requests in `all`; take upstream
  pins (pypdf>=6.12.0, starlette, yt-dlp).
- README.md: our 1C/ArcadeDB preamble (typo ArkadaDB->ArcadeDB) above the
  full upstream README.
- .gitignore: union (our spike/fixtures ignores + upstream .DS_Store).
- test_build.py: keep both test sets. uv.lock regenerated from merged pyproject.
- Dropped upstream's committed .DS_Store files (now gitignored).

Co-Authored-By: Claude Opus 4.8 (1M context) <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.

2 participants