Skip to content

feat(mcp): nested citation addressing + single-count access log - #2303

Closed
dghuieh wants to merge 2 commits into
oceanbase:vldb_2026from
dghuieh:vldb_2026
Closed

dghuieh wants to merge 2 commits into
oceanbase:vldb_2026from
dghuieh:vldb_2026

Conversation

@dghuieh

@dghuieh dghuieh commented Oct 29, 2026

Copy link
Copy Markdown

Which issue or RFC does this PR close?

N/A.

Rationale for this change

MCP tool calls could only address a memory through the legacy flat memory_id, which makes it impossible to reference a specific entry or entry version, and each logical tool call could emit more than one access-log event, so usage accounting was unreliable.

What changes are included in this PR?

  • Nested citation addressing: exact-entry tools (get / update / delete / delete_with_profile) now accept a nested citation object (memory_ref / entry_id / entry_version_id) with precedence memory_ref > entry_id > entry_version_id. The legacy flat memory_id is kept as a backward-compatible alias.
  • Request-scoped request_id via contextvars, shared between the tool body and the access-log record; the internal bridge flag is exposed through mark_internal_bridge / is_internal_bridge.
  • The access_logged decorator now emits exactly one transport.request.completed event per logical tool call (operation=mcp.tools.call, transport=mcp).

Are there any user-facing changes?

No breaking change for existing callers: flat memory_id requests keep working as before. Exact-entry tools additionally accept the nested citation object.

How was this change tested?

Per the commit message of 3b0bfb2: 20 unit tests cover citation resolution, precedence, prefix stripping and single-count logging. Added test file: tests/unit/test_mcp_contract_u456.py.

AI usage statement

Not applicable.

…5/U6)

- U4: exact-entry tools (get/update/delete/delete_with_profile) accept a nested citation object (memory_ref/entry_id/entry_version_id) with precedence memory_ref > entry_id > entry_version_id; legacy flat memory_id kept as backward-compatible alias.

- U5: request-scoped request_id via contextvars, shared by tool body and access-log record; internal bridge flag exposed via mark_internal_bridge/is_internal_bridge.

- U6: access_logged decorator emits exactly one transport.request.completed event per logical tool call (operation=mcp.tools.call, transport=mcp).

- tests: 20 unit tests covering citation resolution, precedence, prefix stripping and single-count logging (all passing).
@hidb4ai hidb4ai closed this Oct 29, 2026
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