Documentation
¶
Overview ¶
Package proxy turns validated tool arguments into an HTTP request and the upstream response into a tool result (SPEC §3.7 steps 5-8).
Every argument is routed by the location the spec declares, under its upstream name; nothing is guessed. The host always comes from the pinned base URL. Path values are percent-encoded and may not be empty, ".", ".." or contain a slash (even percent-encoded); header values may not contain CR, LF or other control characters. Credentials are attached last, only for the pinned origin, and replace anything with the same name.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadArgument = errors.New("bad argument") ErrBuild = errors.New("cannot build request") )
Sentinel errors callers can match with errors.Is.
Functions ¶
Types ¶
type Auth ¶
type Auth struct {
Type AuthType
Header string
Param string
Secret string
Token func(context.Context) (string, error)
}
Auth is a resolved credential.
type Fixed ¶
Fixed is a resolved fixed parameter. If the tool declares a parameter with this name, the spec's location wins; otherwise In is used (query when unset).
type Result ¶
Result is a tool result, ready for MCP. Text is always redacted.
func Call ¶
func Call(ctx context.Context, doer httpx.Doer, t model.Tool, args map[string]any, tg Target, red *redact.Redactor, pick *jsonpick.Picker) Result
Call builds the request, sends it and shapes the response (SPEC §3.7 steps 5-8). It never returns a Go error: every failure is an isError result whose text starts with the tool name. All text passes through red, so no resolved secret reaches the model, successful responses included.
pick, when not nil, keeps only the tool's response_fields of a complete JSON success response (SPEC M6 design note: response field filtering).
type Target ¶
Target is everything about the upstream that isn't per call.
func (Target) SecretValues ¶
SecretValues lists every value that must be redacted wherever it appears (SPEC T11): the credential, the password part of a Basic credential on its own (an upstream may echo just that), and secret fixed values. literal: fixed values are not secrets.