MCPcopy Create free account
hub / github.com/astercloud/aster / writeError

Function writeError

pkg/mcpserver/server.go:174–189  ·  view source on GitHub ↗
(w http.ResponseWriter, id int64, code int, msg string, err error)

Source from the content-addressed store, hash-verified

172}
173
174func writeError(w http.ResponseWriter, id int64, code int, msg string, err error) {
175 m := msg
176 if err != nil {
177 m = fmt.Sprintf("%s: %v", msg, err)
178 }
179
180 resp := cloud.MCPResponse{
181 JSONRPC: "2.0",
182 ID: id,
183 Error: &cloud.MCPError{
184 Code: code,
185 Message: m,
186 },
187 }
188 writeJSON(w, http.StatusOK, resp)
189}

Callers 2

HandlerMethod · 0.85
handleToolsCallMethod · 0.85

Calls 1

writeJSONFunction · 0.70

Tested by

no test coverage detected