selfcall

package
v1.147.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package selfcall carries a request to the platform's own HTTP API that is served inside this process on behalf of a caller the platform has already authenticated (#2086).

The built-in platform-admin connection acts as its caller: a call that carries the caller's token forwards it over the loopback, and the admin and portal authenticators check it like any other. A managed script's run has no token -- it presents the roles its owner held at the save -- so its call is handed to the platform's handler directly, with the identity the tool-call middleware authenticated recorded on the request's context. The authenticators read it from there. A request that arrives over the network cannot carry a context value, so this adds no credential anyone can send.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForCall

func ForCall(ctx context.Context, req *http.Request) (*http.Request, bool)

ForCall marks req to be served inside this process when the tool call it belongs to was authenticated as someone and carries no token to forward: a managed script's run. It reports false, leaving req alone, otherwise.

func From

func From(ctx context.Context) (mcpcontext.Caller, bool)

From returns the caller a request served inside this process was made for, and false for every other request.

func Install

func Install[T any](kits []T, h http.Handler)

Install hands h to every toolkit among kits that serves a connection with the platform's own handler (the api kind's platform-admin connection).

func Transport

func Transport(self, network http.RoundTripper) http.RoundTripper

Transport sends a request ForCall marked through self, and every other request through network.

func With

With returns ctx marked as a request served inside this process for c.

Types

type Handler

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

Handler is the platform's own HTTP handler, set once the server has assembled it. The connection that dispatches to it is registered before the server exists, so it holds this and the server fills it in.

func (*Handler) ServeHTTP

func (s *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves r with the installed handler, or answers 503 when the server has not installed one: a process serving no HTTP API.

func (*Handler) Set

func (s *Handler) Set(h http.Handler)

Set installs the handler requests are served by.

type PersonaError

type PersonaError struct {
	Surface string
	Persona string
	Need    []string
	Caller  string
	Has     []string
}

PersonaError refuses a caller whose roles do not resolve to the persona a surface requires. Its text names the persona, the roles that reach it, and the roles the caller presents.

func (*PersonaError) Error

func (e *PersonaError) Error() string

Jump to

Keyboard shortcuts

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