MCPcopy Create free account
hub / github.com/coder/aibridge / Interceptor

Interface Interceptor

intercept/interceptor.go:15–40  ·  view source on GitHub ↗

Interceptor describes a (potentially) stateful interaction with an AI provider.

Source from the content-addressed store, hash-verified

13
14// Interceptor describes a (potentially) stateful interaction with an AI provider.
15type Interceptor interface {
16 // ID returns the unique identifier for this interception.
17 ID() uuid.UUID
18 // Setup injects some required dependencies. This MUST be called before using the interceptor
19 // to process requests.
20 Setup(logger slog.Logger, rec recorder.Recorder, mcpProxy mcp.ServerProxier)
21 // Model returns the model in use for this [Interceptor].
22 Model() string
23 // ProcessRequest handles the HTTP request.
24 ProcessRequest(w http.ResponseWriter, r *http.Request) error
25 // Specifies whether an interceptor handles streaming or not.
26 Streaming() bool
27 // TraceAttributes returns tracing attributes for this [Interceptor]
28 TraceAttributes(*http.Request) []attribute.KeyValue
29 // Credential returns the credential metadata for this interception.
30 Credential() CredentialInfo
31 // CorrelatingToolCallID returns the ID of a tool call result submitted
32 // in the request, if present. This is used to correlate the current
33 // interception back to the previous interception that issued those tool
34 // calls. If multiple tool use results are present, we use the last one
35 // (most recent). Both Anthropic's /v1/messages and OpenAI's /v1/responses
36 // require that ALL tool results are submitted for tool choices returned
37 // by the model, so any single tool call ID is sufficient to identify the
38 // parent interception.
39 CorrelatingToolCallID() *string
40}

Callers 37

newInterceptionProcessorFunction · 0.65
ProcessRequestMethod · 0.65
marshalEventMethod · 0.65
ProcessRequestMethod · 0.65
ProcessRequestMethod · 0.65
ProcessRequestMethod · 0.65
newInterceptionProcessorFunction · 0.65
SetupMethod · 0.65
SetupMethod · 0.65
SetupMethod · 0.65
SetupMethod · 0.65
SetupMethod · 0.65

Calls

no outgoing calls

Tested by

no test coverage detected