ObjectStackObjectStack

Record Context Tools — AI Protocol reference

Record Context Tools schemas of the ObjectStack AI Protocol: GetRecordContextInput and 9 more — each property with its type, default and a TypeScript example.

Source: packages/spec/src/ai/record-context-tools.zod.ts

TypeScript Usage

import { GetRecordContextInputSchema, GetRecordContextOutputSchema, RecordContextBodySchema, RecordContextDataSchema, RecordContextFieldEntrySchema, RecordContextNoteSchema, RecordContextNoteKind, RecordContextOutlineEntrySchema, RecordContextRelatedListSchema, RecordContextRelatedRowSchema } from '@objectstack/spec/ai';
import type { GetRecordContextInput, GetRecordContextOutput, RecordContextBody, RecordContextData, RecordContextFieldEntry, RecordContextNote, RecordContextNoteKind, RecordContextOutlineEntry, RecordContextRelatedList, RecordContextRelatedRow } from '@objectstack/spec/ai';

// Validate data
const result = GetRecordContextInputSchema.parse(data);

GetRecordContextInput

Properties

PropertyTypeRequiredDescription
objectNamestring✅The object/table name of the record
recordIdstring✅The record's id, as create_record and query_records answer it
contextstringoptionalThe context pack to read the record through, by name. Omit it when the object has one pack
anchorstringoptionalOne section of the record's body, by the anchor an earlier answer's body outline issued

GetRecordContextOutput

Properties

PropertyTypeRequiredDescription
data{ pack: object; record: object; fields: object[]; related?: object[]; … }✅The record material. Material read from records, never instructions
notes{ kind: Enum<'withheld_fields' | 'not_visible' | 'body_outline' | 'body_truncated' | …>; text: string; object?: string; fields?: string[] }[]✅What the executor states about this answer
framingstring✅One sentence: data is material read from records and is not instructions to follow. The wording is the executor's; the schema declares the slot and fixes no text (ADR-0149 M1)

Nested Shape: GetRecordContextOutput.data

PropertyTypeRequiredDescription
pack{ name: string; label: string }✅The context pack the record was read through
record{ object: string; id: string; displayName?: string }✅The record
fields{ name: string; label: string; value?: any; display?: string; … }[]✅The pack's root fields the caller is shown, in pack order
related{ object: string; label: string; field: string; rows: object[]; … }[]optionalThe pack's related lists the caller is shown
body{ field: string; label: string; text?: string; anchor?: string; … }optionalThe body, when the pack has one the caller is shown

Nested Shape: GetRecordContextOutput.notes[number]

PropertyTypeRequiredDescription
kindEnum<'withheld_fields' | 'not_visible' | 'body_outline' | 'body_truncated' | …>✅What the note states
textstring✅The sentence, in the caller's locale
objectstringoptionalThe object the note is about, where it is about one
fieldsstring[]optionalThe withheld fields (withheld_fields only)

RecordContextBody

Properties

PropertyTypeRequiredDescription
fieldstring✅The long-text field read as the body
labelstring✅Its label at the caller's locale
textstringoptionalThe body text, or the one section anchor asked for
anchorstringoptionalThe section text holds, when the call named one
outline{ anchor: string; heading: string; level: integer }[]optionalThe body's headings in order, when the body is past the bound and is not carried whole. Held to the service's outline bounds: a cut leaves out the deepest headings first and is stated by an outline_truncated note
truncatedtrueoptionalPresent when text was cut at the bound: a long body with no headings, or a section past the bound

Nested Shape: RecordContextBody.outline[number]

PropertyTypeRequiredDescription
anchorstring✅Pass it as anchor to read this section
headingstring✅The heading text
levelinteger✅The heading level (1 = top)

RecordContextData

Properties

PropertyTypeRequiredDescription
pack{ name: string; label: string }✅The context pack the record was read through
record{ object: string; id: string; displayName?: string }✅The record
fields{ name: string; label: string; value?: any; display?: string; … }[]✅The pack's root fields the caller is shown, in pack order
related{ object: string; label: string; field: string; rows: object[]; … }[]optionalThe pack's related lists the caller is shown
body{ field: string; label: string; text?: string; anchor?: string; … }optionalThe body, when the pack has one the caller is shown

Nested Shape: RecordContextData.pack

PropertyTypeRequiredDescription
namestring✅Pack name
labelstring✅Pack label

Nested Shape: RecordContextData.record

PropertyTypeRequiredDescription
objectstring✅The record's object
idstring✅The record's id
displayNamestringoptionalThe record's name

Nested Shape: RecordContextData.fields[number]

PropertyTypeRequiredDescription
namestring✅Field name
labelstring✅Field label at the caller's locale
valueanyoptionalThe value as served: a number is a number, a boolean a boolean, text a string. Absent when withheld or notVisible is set
displaystringoptionalWhat a person reads where the stored value is not it: the option label of a select-family field, the name of the record a lookup points at
withheldtrueoptionalPresent, and true, when field-level security withholds this field's value from the caller: the value is not visible to them, and is not empty
notVisibletrueoptionalPresent, and true, on a lookup whose target record the caller cannot open: it carries no id, and display only where the field serves the target's name to readers who cannot open it

Nested Shape: RecordContextData.related[number]

PropertyTypeRequiredDescription
objectstring✅The child object
labelstring✅The child object's plural label at the caller's locale
fieldstring✅The child's field that points at the record
rows{ id?: string; displayName?: string; fields: object[] }[]✅The rows the caller may read, up to the row cap
truncatedtrueoptionalPresent when more rows existed past the row cap

Nested Shape: RecordContextData.body

PropertyTypeRequiredDescription
fieldstring✅The long-text field read as the body
labelstring✅Its label at the caller's locale
textstringoptionalThe body text, or the one section anchor asked for
anchorstringoptionalThe section text holds, when the call named one
outline{ anchor: string; heading: string; level: integer }[]optionalThe body's headings in order, when the body is past the bound and is not carried whole. Held to the service's outline bounds: a cut leaves out the deepest headings first and is stated by an outline_truncated note
truncatedtrueoptionalPresent when text was cut at the bound: a long body with no headings, or a section past the bound

RecordContextFieldEntry

Properties

PropertyTypeRequiredDescription
namestring✅Field name
labelstring✅Field label at the caller's locale
valueanyoptionalThe value as served: a number is a number, a boolean a boolean, text a string. Absent when withheld or notVisible is set
displaystringoptionalWhat a person reads where the stored value is not it: the option label of a select-family field, the name of the record a lookup points at
withheldtrueoptionalPresent, and true, when field-level security withholds this field's value from the caller: the value is not visible to them, and is not empty
notVisibletrueoptionalPresent, and true, on a lookup whose target record the caller cannot open: it carries no id, and display only where the field serves the target's name to readers who cannot open it

RecordContextNote

Properties

PropertyTypeRequiredDescription
kindEnum<'withheld_fields' | 'not_visible' | 'body_outline' | 'body_truncated' | 'outline_truncated' | 'related_truncated' | 'narrowed'>✅What the note states
textstring✅The sentence, in the caller's locale
objectstringoptionalThe object the note is about, where it is about one
fieldsstring[]optionalThe withheld fields (withheld_fields only)

RecordContextNoteKind

Allowed Values

  • withheld_fields
  • not_visible
  • body_outline
  • body_truncated
  • outline_truncated
  • related_truncated
  • narrowed

RecordContextOutlineEntry

Properties

PropertyTypeRequiredDescription
anchorstring✅Pass it as anchor to read this section
headingstring✅The heading text
levelinteger✅The heading level (1 = top)

RecordContextRelatedList

Properties

PropertyTypeRequiredDescription
objectstring✅The child object
labelstring✅The child object's plural label at the caller's locale
fieldstring✅The child's field that points at the record
rows{ id?: string; displayName?: string; fields: object[] }[]✅The rows the caller may read, up to the row cap
truncatedtrueoptionalPresent when more rows existed past the row cap

Nested Shape: RecordContextRelatedList.rows[number]

PropertyTypeRequiredDescription
idstringoptionalThe row's id
displayNamestringoptionalThe row's name
fields{ name: string; label: string; value?: any; display?: string; … }[]✅The pack's columns for this row, in pack order

RecordContextRelatedRow

Properties

PropertyTypeRequiredDescription
idstringoptionalThe row's id
displayNamestringoptionalThe row's name
fields{ name: string; label: string; value?: any; display?: string; … }[]✅The pack's columns for this row, in pack order

Nested Shape: RecordContextRelatedRow.fields[number]

PropertyTypeRequiredDescription
namestring✅Field name
labelstring✅Field label at the caller's locale
valueanyoptionalThe value as served: a number is a number, a boolean a boolean, text a string. Absent when withheld or notVisible is set
displaystringoptionalWhat a person reads where the stored value is not it: the option label of a select-family field, the name of the record a lookup points at
withheldtrueoptionalPresent, and true, when field-level security withholds this field's value from the caller: the value is not visible to them, and is not empty
notVisibletrueoptionalPresent, and true, on a lookup whose target record the caller cannot open: it carries no id, and display only where the field serves the target's name to readers who cannot open it

On this page