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).
Every call on the built-in platform-admin connection is served by the platform's own handler in this process, and its request is marked as made by a tool call (ByTool), whether or not it carries the caller's token (#2656). That marker says who is asking -- an agent, not the person at a browser -- and grants nothing: the routes that make an agent's move wait on a person read it, and nothing authenticates by it. A call that carries the caller's token keeps it, 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 the identity the tool-call middleware authenticated is recorded on the request's context too (With), and the authenticators read it from there. A request that arrives over the network cannot carry a context value, so neither adds a credential anyone can send.
Index ¶
- func ByTool(ctx context.Context) bool
- func ForCall(ctx context.Context, req *http.Request) (*http.Request, bool)
- func From(ctx context.Context) (mcpcontext.Caller, bool)
- func Install[T any](kits []T, h http.Handler)
- func MarkTool(ctx context.Context) context.Context
- func Transport(self http.RoundTripper) http.RoundTripper
- func With(ctx context.Context, c mcpcontext.Caller) context.Context
- type Handler
- type PersonaError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByTool ¶ added in v1.162.1
ByTool reports whether a request was made by a tool call (an agent's call on the platform-admin connection, a managed script's run, a tool that serves itself through the API) rather than by a person's own client. It is the one answer every "is this an agent" check reads (#2656).
func ForCall ¶
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 ¶
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 MarkTool ¶ added in v1.162.1
MarkTool returns ctx marked as a request a tool call made to the platform's own API. It names no one and authenticates nothing.
func Transport ¶
func Transport(self http.RoundTripper) http.RoundTripper
Transport serves every request through self, the platform's own handler, marked as made by a tool call: the transport of the platform-admin connection, every request of which is a tool call's (#2656).
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.
type PersonaError ¶
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