{"modulePath":"github.com/txn2/mcp-data-platform","version":"v1.172.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package catalogapi\n\nPackage catalogapi is the portal's REST surface over the platform catalog (#1921): finding and browsing datasets, reading a dataset with its columns, curation, lineage and history, editing that curation, and the glossary, tags, domains and data products it is curated with.\n\nReading the catalog takes the read level of the persona's portal catalog setting and writing it the write level (#2225). A persona that does not set it resolves it from the two tools that read and curate the catalog over MCP: fetch reads, fetch and apply\\_knowledge write. A dataset, its columns and its schema document belong to a connection, and are read and written only by a caller whose persona reaches that connection. An administrator reaches everything.\n\n## Types\n\n```go\ntype AspectWrite struct {\n\tReference string             `json:\"reference\"`\n\tAspect    catalog.AspectName `json:\"aspect\"`\n\t// Value is the aspect's new value in its own shape; null clears it.\n\tValue json.RawMessage `json:\"value\" swaggertype:\"object\"`\n\t// Expect, when present, is the value the writer read the aspect as (null\n\t// for absent). The write is refused with 409 when the aspect holds\n\t// anything else, so a value built from a stale read never replaces a\n\t// write made since.\n\tExpect json.RawMessage `json:\"expect,omitempty\" swaggertype:\"object\"`\n}\n```\nAspectWrite is one aspect value to write.\n\n```go\ntype BrowseLevel struct {\n\tEntries []catalog.BrowseEntry `json:\"entries\"`\n}\n```\nBrowseLevel is one level of a connection's datasets.\n\n```go\ntype Connection struct {\n\tKind string `json:\"kind\"`\n\tName string `json:\"name\"`\n}\n```\nConnection is one connection the catalog holds datasets for.\n\n```go\ntype ConnectionList struct {\n\tConnections []Connection `json:\"connections\"`\n\tWritable    bool         `json:\"writable\"`\n}\n```\nConnectionList is the connections the caller may browse, and whether the caller may edit the catalog.\n\n```go\ntype DatasetList struct {\n\tResults []catalog.DatasetSummary `json:\"results\"`\n}\n```\nDatasetList is one page of datasets.\n\n```go\ntype DatasetView struct {\n\t*catalog.Dataset\n\tUpstream   []catalog.Hop `json:\"upstream\"`\n\tDownstream []catalog.Hop `json:\"downstream\"`\n\t// Names maps each glossary term and domain reference the curation holds\n\t// to its display name.\n\tNames    map[string]string `json:\"names\"`\n\tWritable bool              `json:\"writable\"`\n}\n```\nDatasetView is a dataset as the dataset page shows it: its columns and curation, the lineage around it the caller may see, the names of the definitions its curation refers to, and whether the caller may edit it.\n\n```go\ntype DefinitionCreate struct {\n\tKind catalog.Kind `json:\"kind\"`\n\tName string       `json:\"name\"`\n\t// Parent is the glossary node a term or node is placed under.\n\tParent      string `json:\"parent,omitempty\"`\n\tDescription string `json:\"description,omitempty\"`\n}\n```\nDefinitionCreate is a definition to create.\n\n```go\ntype DefinitionList struct {\n\tResults []catalog.DefinitionSummary `json:\"results\"`\n}\n```\nDefinitionList is one page of definitions.\n\n```go\ntype DefinitionView struct {\n\t*catalog.Definition\n\tChildren []catalog.DefinitionSummary `json:\"children\"`\n\tUses     []catalog.Use               `json:\"uses\"`\n\t// UsesWithheld counts the carriers on connections the persona does not\n\t// reach.\n\tUsesWithheld int `json:\"uses_withheld\"`\n\t// MoreUses is set when more datasets and columns carry the definition than\n\t// the page lists.\n\tMoreUses bool `json:\"more_uses\"`\n\tWritable bool `json:\"writable\"`\n}\n```\nDefinitionView is a definition as its page shows it: the definition, the glossary entries under a node, the datasets and columns that carry a term, tag or domain the caller's persona reaches, and whether the caller may edit it.\n\n```go\ntype Deps struct {\n\tStore Store\n\t// Connections lists the connections the catalog holds datasets for.\n\tConnections func() []Connection\n\t// PersonaResolver resolves a caller's roles to the persona's tools and\n\t// connection reach; nil leaves the catalog to administrators.\n\tPersonaResolver portal.PersonaResolver\n\t// AdminRoles are the admin persona's roles, read only when IsAdmin is nil.\n\tAdminRoles []string\n\t// IsAdmin is the platform's one administrator rule (#2228).\n\tIsAdmin func(roles []string) bool\n\t// Audit records each write; nil records none.\n\tAudit audit.Logger\n}\n```\nDeps holds what the handler reads and writes through.\n\n```go\ntype Handler struct {\n\t// contains filtered or unexported fields\n}\n```\nHandler serves the portal catalog routes.\n\n```go\nfunc New(deps Deps) *Handler\n```\nNew returns the handler.\n\n```go\nfunc (h *Handler) Register(mux *http.ServeMux)\n```\nRegister mounts the routes on the portal mux, behind the portal's own authentication.\n\n```go\ntype History struct {\n\tChanges []catalog.Change `json:\"changes\"`\n}\n```\nHistory is the changes to an entity's curation, newest first.\n\n```go\ntype RollbackRequest struct {\n\tReference string             `json:\"reference\"`\n\tAspect    catalog.AspectName `json:\"aspect\"`\n\tChangeID  string             `json:\"change_id\"`\n}\n```\nRollbackRequest names the change to undo and the entity and aspect it belongs to.\n\n```go\ntype SchemaDocumentView struct {\n\t*catalog.SchemaDocument\n\tContent string `json:\"content\"`\n}\n```\nSchemaDocumentView is a schema document with its content as text.\n\n```go\ntype Store interface {\n\tcatalog.Store\n\tGetDocument(ctx context.Context, ref catalog.Ref) (*catalog.SchemaDocument, error)\n}\n```\nStore is the catalog the handler reads and writes, with the connections' schema documents. catalogstore.Store implements it.\n\n","path":"github.com/txn2/mcp-data-platform/internal/httpserver/catalogapi","name":"catalogapi","synopsis":"Package catalogapi is the portal's REST surface over the platform catalog (#1921): finding and browsing datasets, reading a dataset with its columns, curation, lineage and history, editing that curation, and the glossary, tags, domains and data products it is curated with.","isRedistributable":true}
