MCPcopy
hub / github.com/grafana/tempo / injectMuxVars

Function injectMuxVars

modules/frontend/mcp_tools.go:364–369  ·  view source on GitHub ↗

injectMuxVars uses the mux.SetVars method to add vars into the context that can be used by downstream handlers. a few Tempo endpoints rely on the mux routing package extracting vars from the request path. this method allows us to do the same for MCP tools.

(ctx context.Context, req *http.Request, vars map[string]string)

Source from the content-addressed store, hash-verified

362// a few Tempo endpoints rely on the mux routing package extracting vars from the request path. this method allows
363// us to do the same for MCP tools.
364func injectMuxVars(ctx context.Context, req *http.Request, vars map[string]string) (*http.Request, context.Context) {
365 req = req.WithContext(ctx)
366 req = mux.SetURLVars(req, vars)
367
368 return req, req.Context()
369}
370
371// buildPath is a helper method to build a path with the path prefix
372func (s *MCPServer) buildPath(p string) string {

Callers 3

handleGetTraceMethod · 0.85
TestInjectMuxVarsFunction · 0.85

Calls 1

ContextMethod · 0.65

Tested by 1

TestInjectMuxVarsFunction · 0.68