Documentation
¶
Overview ¶
Package aitabletarget provides deterministic AI Table URL and name resolution shared by read and write shortcuts. It never guesses among multiple candidates and treats an incomplete/unknown response as an error.
Index ¶
Constants ¶
const EntitySearchPageSize = 50
Variables ¶
This section is empty.
Functions ¶
func Pagination ¶ added in v1.0.61
Pagination returns the paging facts published by an MCP response. Callers must prefer an explicit hasMore=false over a stale cursor echoed by the service: a completed page is terminal even when the payload retains the request cursor.
Types ¶
type EntityCandidate ¶ added in v1.0.62
type EntityCandidate struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Reference EntityReference `json:"reference"`
}
EntityCandidate is one non-sensitive search candidate used for disambiguation.
type EntityReference ¶ added in v1.0.62
type EntityReference struct {
UserID string `json:"userId,omitempty"`
CorpID string `json:"corpId,omitempty"`
UserRef string `json:"userRef,omitempty"`
DepartmentID string `json:"departmentId,omitempty"`
DepartmentKey string `json:"departmentKey,omitempty"`
CID string `json:"cid,omitempty"`
}
EntityReference is the external identity that can be passed to AITable filters. Only one entity type is populated; MCP may return compatible aliases for it.
type EntityResolution ¶ added in v1.0.62
type EntityResolution struct {
Status string `json:"status"`
EntityType EntityType `json:"entityType"`
Query string `json:"query"`
MatchType string `json:"matchType"`
Selected EntityCandidate `json:"selected"`
Profile string `json:"profile,omitempty"`
}
EntityResolution is returned only for a unique exact display-name match.
func ResolveEntity ¶ added in v1.0.62
func ResolveEntity(reader Reader, entityType EntityType, query string) (EntityResolution, error)
ResolveEntity selects only one exact normalized name match. A single fuzzy candidate still returns not_found together with candidates, never success.
type EntitySearchResult ¶ added in v1.0.62
type EntitySearchResult struct {
EntityType EntityType `json:"entityType"`
Keyword string `json:"keyword"`
Candidates []EntityCandidate `json:"candidates"`
Profile string `json:"profile,omitempty"`
}
EntitySearchResult contains a complete, de-duplicated candidate set.
func SearchEntities ¶ added in v1.0.62
func SearchEntities(reader Reader, entityType EntityType, keyword string) (EntitySearchResult, error)
SearchEntities reads every search_entities page before returning candidates. A declared continuation without a usable cursor fails closed, because a partial candidate set cannot prove that a display name is unique.
type EntityType ¶ added in v1.0.62
type EntityType string
EntityType is the stable search_entities type accepted by AITable MCP.
const ( EntityPerson EntityType = "PERSON" EntityDepartment EntityType = "DEPARTMENT" EntityGroup EntityType = "GROUP" )
func ParseEntityType ¶ added in v1.0.62
func ParseEntityType(raw string) (EntityType, error)
ParseEntityType validates the public PERSON/DEPARTMENT/GROUP enum.
type Reader ¶
type Reader interface {
CallMCPData(product, tool string, params map[string]any) (map[string]any, error)
}
Reader is the read-only transport required for name resolution.
type Resolution ¶
type Resolution struct {
Status string `json:"status"`
EntityType string `json:"entityType"`
Query string `json:"query"`
MatchType string `json:"matchType"`
Selected Candidate `json:"selected"`
}
Resolution is returned only after exactly one candidate is selected.
func ResolveBaseName ¶
func ResolveBaseName(reader Reader, name string, allowFuzzy bool) (Resolution, error)
ResolveBaseName resolves one Base by exact name. A substring match is used only when allowFuzzy is true. Zero/multiple candidates and incomplete pages are structured non-zero errors.
func ResolveChildName ¶ added in v1.0.62
func ResolveChildName(reader Reader, baseID, tableID, kind, name string) (Resolution, error)
ResolveChildName uses complete field/view directories and refuses malformed, duplicate, or ambiguous candidates before returning an ID.
func ResolveTableName ¶
func ResolveTableName(reader Reader, baseID, name string, allowFuzzy bool) (Resolution, error)
ResolveTableName resolves one table within a known Base using get_tables.
type Target ¶
type Target struct {
SchemaVersion string `json:"schemaVersion"`
Source string `json:"source"`
Kind string `json:"kind"`
BaseID string `json:"baseId"`
TableID string `json:"tableId,omitempty"`
ViewID string `json:"viewId,omitempty"`
RecordID string `json:"recordId,omitempty"`
}
Target is the normalized identity carried by an AI Table URL.