Skip to content

MCP query tools should let the assistant ask for relations #851

Description

@borisno2

This was generated by AI during triage.

Follow-up from #848 / ADR-0024 (#849). Filed as agreed during that triage; not yet specified.

After #848, the derived MCP query tool issues a bare read and so returns scalars plus foreign keys. That is the right default for a tool result — a five-level relation tree lands byte-for-byte in a context window — and relations stay reachable, because an assistant can follow a foreign key with a second tool call.

If assistants turn out to round-trip often enough for that to be the wrong trade, the fix is to let them ask: an include argument on the tool's input schema.

The part that needs thought before it's built: a caller-supplied include that names a relation deeper than the Access Filter can scope throws AccessScopeDepthExceededError. Coming from an assistant, that is a thrown error where a tool result was expected, so it needs to surface as something the model can recover from — an error result naming what it asked for and why it was refused, not a 500. Worth deciding at the same time whether the include should be depth-limited in the schema itself, so the common case is unreachable rather than caught.

Not urgent. Worth revisiting once there's real usage data on how assistants navigate related data through the tools.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageMaintainer needs to evaluate this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions