Documentation
¶
Overview ¶
Package connview builds the list_connections view: the connections a deployment holds, each enriched with the canonical knowledge pages that reference it (#634). It lives outside pkg/platform so that package stays within its size budget, and depends only on narrow capabilities (a source resolver, a knowledge-page reverse lookup and the connection store) rather than on the platform itself.
A connection exists because the connection store holds a row for it, not because this process has built one. Several replicas run over one database, and a connection saved through one of them is a row before it is anything in the others' memory, so an enumeration answered from what this process serves answers for this process rather than for the deployment: an operator who adds a connection and asks what exists is told a different thing depending on which replica the load balancer picked (#1757). The store is therefore what is enumerated, and what this process serves supplies the per-process detail the row cannot carry — a connection's health is the outcome of calls this replica made.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶ added in v1.132.0
type Deps struct {
Source SourceResolver
Pages PageLookup
Permit Permit
Stored StoreLister
}
Deps are Build's collaborators, each optional: a nil Source omits the DataHub source names, a nil Pages skips the knowledge enrichment, a nil Permit enumerates every connection (what a system caller with no persona needs), and a nil Stored enumerates only what this process serves.
type Entry ¶
type Entry struct {
Kind string `json:"kind"`
Name string `json:"name"`
Connection string `json:"connection"`
// Reference is the canonical mcp:connection:(kind,name) citation string, so an
// agent can reference this connection from a knowledge page without composing
// it by hand.
Reference string `json:"reference,omitempty"`
Description string `json:"description,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
DataHubSourceName string `json:"datahub_source_name,omitempty"`
CatalogID string `json:"catalog_id,omitempty"`
OperationCount int `json:"operation_count,omitempty"`
Health *toolkit.ConnectionHealthWire `json:"health,omitempty"`
// KnowledgePageCount is the total number of knowledge pages that reference this
// connection; KnowledgePages carries a bounded sample of them (#634).
KnowledgePageCount int `json:"knowledge_page_count,omitempty"`
KnowledgePages []KnowledgePage `json:"knowledge_pages,omitempty"`
}
Entry describes a single toolkit connection. CatalogID and OperationCount are populated only for kinds where they have meaning (today: api).
type KnowledgePage ¶
type KnowledgePage struct {
ID string `json:"id"`
Slug string `json:"slug"`
Title string `json:"title"`
}
KnowledgePage is a brief reference to a knowledge page documenting a connection.
type Output ¶
type Output struct {
Connections []Entry `json:"connections"`
Count int `json:"count"`
Withheld int `json:"withheld,omitempty"`
Notice string `json:"notice,omitempty"`
}
Output is the JSON response for the list_connections tool. Withheld and Notice are present only when the caller's persona hid connections (#1108): the enumeration reports what it removed and why instead of quietly returning a short list that reads as the whole deployment.
func Build ¶
Build enumerates the connections the deployment holds that deps.Permit admits and enriches each with the knowledge pages that reference it (bounded by maxKnowledgePages). Every field of deps may be nil.
What this process serves is enumerated first, because it answers with the per-process detail a row cannot carry, and the store supplies every connection left — a connection saved through another replica, which is a row here before it is anything else (#1757). Nothing is built to list it: a connection is put in service by the call that addresses it, which reads the same row.
A connection the permit rejects is counted, not merely dropped: the count (and the notice built from it) is what distinguishes "this deployment has one connection" from "you may see one of its connections".
type PageLookup ¶
type PageLookup interface {
ListPagesReferencing(ctx context.Context, ref knowledgepage.EntityRef) ([]knowledgepage.PageRef, error)
}
PageLookup is the knowledge-page reverse lookup: the pages referencing a target.
type Permit ¶ added in v1.117.0
Permit reports whether the caller may see a connection. Build applies it before the (per-connection, concurrent) knowledge enrichment, so a hidden connection costs no lookup. A nil Permit enumerates every connection, which is what a system caller with no persona (the connection backfill) needs.
type SourceResolver ¶
SourceResolver resolves a connection's DataHub source name (empty when none).
type StoreLister ¶ added in v1.132.0
StoreLister lists every connection the store holds, across kinds. A deployment that keeps connections in its configuration file alone wires none, and the enumeration is what this process serves.
type Stored ¶ added in v1.132.0
type Stored struct {
Kind string
Name string
Description string
CatalogID string
OperationCount int
}
Stored is one connection as the connection store holds it. The fields are the ones a row answers on its own: what the connection is called, what it is, and — for a kind whose operations the catalog holds — how large its surface is. Health is absent by construction, being the outcome of calls a particular replica made.