Documentation
¶
Overview ¶
Package connview builds the list_connections view: the configured connections across toolkits, 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 and a knowledge-page reverse lookup) rather than on the platform itself.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectionNames ¶ added in v1.117.0
ConnectionNames returns the persona-facing connection names a toolkit currently serves: every connection a multi-connection toolkit enumerates, or the single configured connection name of one that does not. These are the names a persona's connections rules match and a tool call's `connection` argument carries, so callers that reason about connection permissions resolve them here rather than assuming a toolkit is its connection.
Types ¶
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 ¶
func Build(ctx context.Context, toolkits []registry.Toolkit, src SourceResolver, pages PageLookup, permit Permit) Output
Build enumerates the connections across the toolkits that permit admits and enriches each with the knowledge pages that reference it (bounded by maxKnowledgePages). src, pages, and permit may be nil; a nil page lookup skips the knowledge enrichment and a nil permit enumerates every connection.
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).