Expose lookup columns in the view field AI tools

Merged
FE
17h ago
+184-0

App manifests can already declare lookup columns (#30472). The view AI/MCP tools could not, and no manifest sync test declared one. This PR closes both gaps.

Changes

  • View-field tools:
    • create_view_field and create_many_view_fields accept isCanonical (default true) and relationTargetFieldMetadataId, so they can add a lookup column next to a relation's own column.
    • update_view_field and update_many_view_fields accept relationTargetFieldMetadataId; null shows the related record again.
    • create_view_field, update_view_field and get_view_fields return both fields.
  • The tools only pass values through; the server validators enforce the rules.
  • Not changed: upsert_complete_view reconciles columns by field and doesn't model extra columns.

Stack

Lookup columns show one field of the record a many-to-one relation points to (Company › Address on People); aggregate columns show a count or sum over a one-to-many relation (People › Count on Companies). Each PR targets the one it builds on; retarget it to main once that one merges.

Size counts changed lines outside tests and generated files: S < 300, M 300–800, L > 800.

PRWhat it doesSizeCodeTests / generatedBuilds on
#30472Server: a view field can show one field of its related record (relationTargetFieldMetadataId)M+401 −39+552 −3merged into main
#30450 👈Server: lookup columns in the view field AI toolsS+32+152main
#30348Front: tables handle several columns of one fieldS+289 −70+193merged into main
#30439Front: lookup columns, added from the + menuL+1025 −234+421 −30main
#30482Server + front: aggregate columns (count, sum, avg, min, max)L+1200 −268+1725 −122#30439

Independent of this stack: #30347 (nested one-to-many filter / orderBy / first) and #30485 (upsertViewWidget keeps omitted filter group fields and clears them on null), both on main.

Testing

  • Integration: new successful-sync-application-lookup-view-field (an app declares a non-canonical many-to-one view field and its lookup target resolves); MCP view tools snapshot updated.
  • Server typecheck and oxlint.

Generated by Claude Code