completionlayer

package
v1.102.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package completionlayer implements the MCP completion/complete handler for the platform: argument autocompletion for prompt arguments and resource-template variables. It lives in its own facade-internal package so the platform facade stays within its size budget and the completion logic is cohesive and independently testable. It owns all value providers (dataset/topic/connection names, catalog/schema/table, glossary terms), the persona gating that mirrors tools/list visibility, and the interactive latency budget and value cap.

Index

Constants

View Source
const MaxValues = 100

MaxValues is the spec-mandated ceiling on the number of completion values returned in a single completion/complete response. A provider may find more; the handler truncates to this many and sets HasMore.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Authenticator    middleware.Authenticator
	Authorizer       middleware.Authorizer // nil => no persona filtering (allow all)
	PersonasForRoles middleware.PersonasForRoles
	AdminPersona     string

	Semantic        semantic.Provider
	Query           query.Provider
	Registry        *registry.Registry
	PersonaRegistry *persona.Registry

	// Timeout bounds the upstream lookups a completion performs. Zero uses
	// defaultTimeout.
	Timeout time.Duration
}

Deps carries the platform primitives the completion handler needs, kept as plain values so this package never imports the platform package (which would cycle).

type Handle

type Handle struct {
	// contains filtered or unexported fields
}

Handle owns the completion handler and its value providers.

func New

func New(deps Deps) *Handle

New builds a completion Handle from its dependencies.

func (*Handle) Handler

func (h *Handle) Handler() func(context.Context, *mcp.CompleteRequest) (*mcp.CompleteResult, error)

Handler returns the completion/complete handler for ServerOptions. It resolves the caller (unauthenticated → empty), applies the interactive latency budget, and shapes the result to the spec's value cap. An unauthenticated session — or one whose lookups time out — receives an empty completion set, never an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL