MCPcopy
hub / github.com/mudler/LocalAI / jsonResult

Function jsonResult

pkg/mcp/localaitools/errors.go:26–34  ·  view source on GitHub ↗

jsonResult marshals v as pretty JSON and returns it as the tool's TextContent payload. Errors during marshalling become tool errors.

(v any)

Source from the content-addressed store, hash-verified

24// jsonResult marshals v as pretty JSON and returns it as the tool's
25// TextContent payload. Errors during marshalling become tool errors.
26func jsonResult(v any) *mcp.CallToolResult {
27 data, err := json.MarshalIndent(v, "", " ")
28 if err != nil {
29 return errorResult(fmt.Errorf("marshal tool result: %w", err))
30 }
31 return &mcp.CallToolResult{
32 Content: []mcp.Content{&mcp.TextContent{Text: string(data)}},
33 }
34}

Callers 10

registerBackendToolsFunction · 0.85
registerModelToolsFunction · 0.85
registerStateToolsFunction · 0.85
registerPIIToolsFunction · 0.85
registerBrandingToolsFunction · 0.85
registerAliasToolsFunction · 0.85
registerSystemToolsFunction · 0.85
registerConfigToolsFunction · 0.85
registerMiddlewareToolsFunction · 0.85
registerUsageToolsFunction · 0.85

Calls 1

errorResultFunction · 0.85

Tested by

no test coverage detected