Documentation
¶
Overview ¶
Package usage counts MCP tool calls in a database next to the index. The index is rebuilt when its schema changes; this file is not. Nothing here is sent anywhere.
Index ¶
- func EstimateSaved(tool string, responseBytes int, fileBytes int64) int
- func Format(rep Report, dollarsPerMillion float64) string
- func ResultStats(structured any) (responseBytes int, empty bool, files []string)
- type Recorder
- func (r *Recorder) Close() error
- func (r *Recorder) Middleware(sizes func(paths []string) (int64, error)) mcp.Middleware
- func (r *Recorder) Record(tool string, responseBytes int, empty bool, savedBytes int)
- func (r *Recorder) SessionLine(dollarsPerMillion float64) string
- func (r *Recorder) Since(t time.Time) (Report, error)
- type Report
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateSaved ¶
EstimateSaved returns how many response bytes were smaller than the files the result points at. Tools outside readInstead return 0.
Types ¶
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder appends one row per tool call.
func (*Recorder) Middleware ¶
Middleware records tools/call responses. sizes returns the total indexed size of the named files.
func (*Recorder) Record ¶
Record stores one tool call. saved is an estimated number of bytes the agent did not have to read. Failures are ignored: accounting must not break a tool call.
func (*Recorder) SessionLine ¶
SessionLine is one log line for the calls recorded since Open.
type Report ¶
Report is a total over a time window.
func (Report) SavedTokens ¶
SavedTokens estimates tokens of source the responses stood in for.