MCPcopy Create free account
hub / github.com/bytebase/bytebase / formatCallOutput

Function formatCallOutput

backend/api/mcp/tool_call.go:110–129  ·  view source on GitHub ↗
(output CallOutput, endpoint *EndpointInfo)

Source from the content-addressed store, hash-verified

108}
109
110func formatCallOutput(output CallOutput, endpoint *EndpointInfo) string {
111 var sb strings.Builder
112
113 fmt.Fprintf(&sb, "## %s\n\n", endpoint.OperationID)
114
115 if output.Error != "" {
116 fmt.Fprintf(&sb, "**Error** (HTTP %d): %s\n\n", output.Status, output.Error)
117 } else {
118 fmt.Fprintf(&sb, "**Status:** %d OK\n\n", output.Status)
119 }
120
121 if output.Response != nil {
122 respBytes, _ := json.MarshalIndent(output.Response, "", " ")
123 sb.WriteString("**Response:**\n```json\n")
124 sb.Write(respBytes)
125 sb.WriteString("\n```\n")
126 }
127
128 return sb.String()
129}
130
131func isBinaryContentType(ct string) bool {
132 ct = strings.ToLower(ct)

Callers 3

TestFormatCallOutputFunction · 0.85
handleCallAPIMethod · 0.85

Calls 1

StringMethod · 0.65

Tested by 2

TestFormatCallOutputFunction · 0.68