MCPcopy Index your code
hub / github.com/github/github-mcp-server / withCSVOutput

Function withCSVOutput

pkg/github/csv_output.go:49–57  ·  view source on GitHub ↗

withCSVOutput wraps the handler of every default-toolset list_* tool so that, at request time, it checks the csv_output feature flag and converts the JSON text response to CSV when enabled. The tool's schema, name, and scope are unchanged — only the response payload format differs.

(tools []inventory.ServerTool)

Source from the content-addressed store, hash-verified

47// text response to CSV when enabled. The tool's schema, name, and scope are
48// unchanged — only the response payload format differs.
49func withCSVOutput(tools []inventory.ServerTool) []inventory.ServerTool {
50 for i := range tools {
51 if !isCSVOutputTool(tools[i]) {
52 continue
53 }
54 tools[i].HandlerFunc = wrapHandlerWithCSVOutput(tools[i].HandlerFunc)
55 }
56 return tools
57}
58
59// isCSVOutputTool reports whether the given tool should have its handler
60// wrapped to honor the csv_output feature flag. Wrapping happens at slice

Calls 2

isCSVOutputToolFunction · 0.85
wrapHandlerWithCSVOutputFunction · 0.85