Skip to content

Add sparse fieldsets (fields) to get/list tools#2

Merged
Azdaroth merged 1 commit into
masterfrom
add-sparse-fieldsets
Jul 2, 2026
Merged

Add sparse fieldsets (fields) to get/list tools#2
Azdaroth merged 1 commit into
masterfrom
add-sparse-fieldsets

Conversation

@Azdaroth

@Azdaroth Azdaroth commented Jul 2, 2026

Copy link
Copy Markdown
Member

Add an optional fields argument to the get and list tools (JSON:API sparse fieldsets): return only the named attributes and/or relationships, shrinking the MCP response. Attribute and relationship names share one flat namespace; unknown names are rejected with InvalidParams.

  • Serializer::Base honors fields: natively (serialize_one/collection/ serializable_hash); unselected has_many links are never queried, and the links block is omitted when no relationship is selected.
  • FieldSelection parses/validates the request; Serialization bridges the executors to the serializer, pruning output for injected serializers that predate the fields: kwarg so the injection contract is unchanged.
  • Omitting fields returns the full shape exactly as before (backward compatible).

Bumps version 0.1.0 -> 0.2.0.

Add an optional `fields` argument to the `get` and `list` tools (JSON:API
sparse fieldsets): return only the named attributes and/or relationships,
shrinking the MCP response. Attribute and relationship names share one flat
namespace; unknown names are rejected with InvalidParams.

- Serializer::Base honors `fields:` natively (serialize_one/collection/
  serializable_hash); unselected has_many links are never queried, and the
  links block is omitted when no relationship is selected.
- FieldSelection parses/validates the request; Serialization bridges the
  executors to the serializer, pruning output for injected serializers that
  predate the `fields:` kwarg so the injection contract is unchanged.
- Omitting `fields` returns the full shape exactly as before (backward compatible).

Bumps version 0.1.0 -> 0.2.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Azdaroth Azdaroth merged commit 5a719cd into master Jul 2, 2026
10 checks passed
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.

1 participant