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

Struct Client

pkg/mcp/localaitools/inproc/client.go:40–67  ·  view source on GitHub ↗

Client implements localaitools.LocalAIClient by calling LocalAI services directly. It is intentionally a thin shim — distribution and persistence concerns are handled by the underlying services (GalleryService is already distributed-aware, ModelConfigLoader manages on-disk YAML, etc.), so this layer

Source from the content-addressed store, hash-verified

38// distributed-aware, ModelConfigLoader manages on-disk YAML, etc.), so this
39// layer just translates between MCP DTOs and service signatures.
40type Client struct {
41 AppConfig *config.ApplicationConfig
42 SystemState *system.SystemState
43 ConfigLoader *config.ModelConfigLoader
44 ModelLoader *model.ModelLoader
45 Gallery *galleryop.GalleryService
46
47 // StatsRecorder and FallbackUser are optional — they back the
48 // get_usage_stats tool. nil StatsRecorder makes the tool return an
49 // "unavailable" error, which keeps the assistant responsive on
50 // deployments that ran with --disable-stats or where startup wired
51 // the inproc client before stats were ready.
52 StatsRecorder *billing.Recorder
53 FallbackUser *auth.User
54
55 // PIIRedactor and PIIEvents back the list_pii_patterns,
56 // get_pii_events, and test_pii_redaction tools. nil values cause
57 // the tools to return a "filter disabled" error.
58 PIIRedactor *pii.Redactor
59 PIIEvents pii.EventStore
60
61 // RouterDecisions backs the get_router_decisions tool. nil makes
62 // the tool return an empty list — same shape the REST endpoint
63 // returns when stats are disabled.
64 RouterDecisions router.DecisionStore
65
66 modelAdmin *modeladmin.ConfigService
67}
68
69// New builds a Client wired to the given services. All fields are required
70// except ModelLoader (used only for SystemInfo's loaded-models report and

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected