MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / writeJSON

Function writeJSON

internal/mcp/client.go:258–271  ·  view source on GitHub ↗
(path string, data map[string]any)

Source from the content-addressed store, hash-verified

256}
257
258func writeJSON(path string, data map[string]any) error {
259 if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
260 return fmt.Errorf("mcp: mkdir %s: %w", filepath.Dir(path), err)
261 }
262 out, err := json.MarshalIndent(data, "", " ")
263 if err != nil {
264 return fmt.Errorf("mcp: marshal %s: %w", path, err)
265 }
266 out = append(out, '\n')
267 if err := os.WriteFile(path, out, 0o600); err != nil {
268 return fmt.Errorf("mcp: write %s: %w", path, err)
269 }
270 return nil
271}
272
273// ServerFromSchema constructs a Server from a registry schema, choosing the
274// preferred installation method. Returns an error when the schema has no

Callers 2

AddServerFunction · 0.70
RemoveServerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected