MCPcopy
hub / github.com/github/github-mcp-server / withToolset

Function withToolset

pkg/http/handler.go:166–172  ·  view source on GitHub ↗

withToolset is middleware that extracts the toolset from the URL and sets it in the request context

(next http.Handler)

Source from the content-addressed store, hash-verified

164
165// withToolset is middleware that extracts the toolset from the URL and sets it in the request context
166func withToolset(next http.Handler) http.Handler {
167 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
168 toolset := chi.URLParam(r, "toolset")
169 ctx := ghcontext.WithToolsets(r.Context(), []string{toolset})
170 next.ServeHTTP(w, r.WithContext(ctx))
171 })
172}
173
174// withInsiders is middleware that sets insiders mode in the request context
175func withInsiders(next http.Handler) http.Handler {

Callers

nothing calls this directly

Calls 2

WithToolsetsMethod · 0.80
ServeHTTPMethod · 0.80

Tested by

no test coverage detected