Documentation
¶
Overview ¶
Package client is a minimal MCP client over HTTP (JSON-RPC 2.0). The `cartographer agents/connect/status/sync` commands use it to talk to a remote cartographer server. The client always uses HTTP (see D37): generating stdio MCP configs is out of scope, the CLI itself is the only consumer.
Index ¶
- Constants
- Variables
- func AtlasURL(serverURL string) (string, error)
- func CheckServerURL(rawURL string, allowInsecure bool) error
- func DecodeAuthor(value string) (author string, ok bool)
- func DecodeResult(text string, v any) error
- func EncodeAuthor(author string) string
- func Escape(s string) string
- func EscapeCap(s string, max int) string
- func HTTPClient(base *http.Client, allowInsecure bool) *http.Client
- func HasControl(s string) bool
- func IsLoopbackHost(host string) bool
- func IsServerHealth(status, version string) bool
- func PerKBName(serverURL string) string
- func RedirectPolicy(allowInsecure bool) func(req *http.Request, via []*http.Request) error
- func RequestMeta(version string) map[string]any
- func RoutedEndpoint(serverURL, routedPath string) (string, error)
- func ServerBase(serverURL string) (*url.URL, error)
- func ToolRequiresWrite(name string) bool
- func UnreachableMessage(reqURL string, err error) string
- func VerifyServer(serverURL string, allowInsecure bool, hc *http.Client) error
- type Health
- type HealthCapability
- type HealthKB
- type HealthPush
- type HeartbeatAnswer
- type MCPClient
- func (c *MCPClient) Call(tool string, args any) (json.RawMessage, error)
- func (c *MCPClient) CallContext(ctx context.Context, tool string, args any) (json.RawMessage, error)
- func (c *MCPClient) CallTool(tool string, args any) (ToolOutput, error)
- func (c *MCPClient) Health(timeout time.Duration) (*Health, error)
- func (c *MCPClient) Heartbeat(report any, timeout time.Duration) (*HeartbeatAnswer, error)
- func (c *MCPClient) ListTools() ([]ToolInfo, error)
- func (c *MCPClient) ListToolsContext(ctx context.Context) ([]ToolInfo, error)
- func (c *MCPClient) Ping(timeout time.Duration) error
- func (c *MCPClient) ReportClientSettings(report any, timeout time.Duration) error
- func (c *MCPClient) ReportRuns(report any, timeout time.Duration) (*RunsAnswer, error)
- func (c *MCPClient) ReportSurveyorSettings(report any, timeout time.Duration) error
- func (c *MCPClient) ReportUsage(kbName string, entries any, timeout time.Duration) error
- func (c *MCPClient) UnauthorizedError() error
- func (c *MCPClient) WithAuthor(author string) *MCPClient
- func (c *MCPClient) WithHTTPTimeout(d time.Duration) *MCPClient
- func (c *MCPClient) WithInsecureHTTP(allow bool) *MCPClient
- func (c *MCPClient) WithKB(name string) *MCPClient
- func (c *MCPClient) WithRoutedKB(name string) *MCPClient
- func (c *MCPClient) WithTokenEnv(name string) *MCPClient
- type RemoteError
- type RemoteState
- type RunsAnswer
- type SkippedKB
- type ToolInfo
- type ToolOutput
Constants ¶
const ( CodeDNSFailed = "dns_failed" CodeUnreachable = "unreachable" CodeHTTPFailed = "http_failed" CodeMCPFailed = "mcp_failed" // CodeStarting is a reachable server whose /health says it is still // bootstrapping its KBs: not a network failure, retry shortly. CodeStarting = "starting" )
Remote error codes (D120): stable, machine-readable strings surfaced in `cartographer status --output json` and matched by cmd/cartographer's unified classifier.
const AuthorHeader = "Cartographer-Author"
AuthorHeader carries the author of a tool call's writes, as "Name <email>" (D904) in its EncodeAuthor form. The server reads it, and the clients send it on tools/call only: it names a person, so it goes where a commit can come of it.
const ClientName = "cartographer"
ClientName identifies this client in the server's roster, and tells the server a caller is the CLI, which decodes one JSON answer per tool call and so never receives the doctor nudge (D299).
const InsecureHTTPEnv = "CARTOGRAPHER_ALLOW_INSECURE_HTTP"
InsecureHTTPEnv is the environment variable that opts a run into cleartext http:// to a non-loopback host, for one-off and unattended use.
const InternalErrorPrefix = "internal error"
InternalErrorPrefix opens the text of a tool's internal-error result (a recovered panic, a handler's Go error, D1516): the server writes it and the Surveyor recognises it as a report candidate (D1925), so the words are one constant.
const ProtocolVersion = "2026-07-28"
ProtocolVersion is the MCP revision this client speaks. It is sent on every request, in the body's _meta and mirrored in the headers, rather than agreed once in a handshake: 2026-07-28 removed initialize, and a stateless server decides per request.
Variables ¶
var ErrNotCartographerServer = errors.New("the address does not answer as a Cartographer server")
ErrNotCartographerServer is wrapped by the error of a request that was not sent because the configured URL did not answer /health as a Cartographer server. Matches with errors.Is.
ErrUnauthorized indicates the server rejected the request with HTTP 401 — distinguished from other failures (network down, timeout, 5xx) so callers probing a server before committing to a connect (Ping, D64) can tell "wrong token/env" apart from "server unreachable" and word their error accordingly.
var ReadOnlyToolNames = map[string]bool{ "atlas_overview": true, "index_get": true, "concept_read": true, "concept_history": true, "log_tail": true, "changes_since": true, "validate": true, "map_list": true, "concept_list": true, "graph_neighbors": true, "graph_context": true, "link_suggest": true, "graph_path": true, "search": true, "lint": true, "gate_check": true, "kb_status": true, "kb_review": true, "work_list": true, "kb_guide": true, "conflicts_list": true, "service_get": true, "service_list": true, "skill_list": true, "sync_check": true, "sync_pull": true, "sync_status": true, "artifact_read": true, "artifact_list": true, "template_list": true, "preset_list": true, "asset_read": true, "asset_list": true, "source_list": true, }
ReadOnlyToolNames is the source-of-truth list of tool names that never mutate KB content and are therefore safe to call with a read-only ("kb:<name>:r") scope token. It lives here, not in mcpserver, so the local bridge can ask whether a call writes without linking the server. mcpserver.ToolRequiresWrite answers from it; TestReadOnlyToolsGolden (httpserver_auth_test.go) builds a real registry via RegisterKBTools and fails if the list and the ReadOnly field of the tools diverge.
Functions ¶
func AtlasURL ¶ added in v0.29.0
AtlasURL is where the server at serverURL serves the Atlas UI: its base (ServerBase) plus /ui/, without any userinfo. Whether the server has the Atlas enabled is not known here.
func CheckServerURL ¶ added in v0.26.0
CheckServerURL is the one gate every client request passes: the bearer token must not leave for a non-loopback http:// URL unless allowInsecure is set. https is always accepted; any other scheme, or an unparsable URL, is refused.
func DecodeAuthor ¶ added in v0.25.0
DecodeAuthor is the author a header value carries: the decoded text of the SEP-2243 form, else the value itself. ok is false when the form's base64 is invalid. The result is not yet a valid identity: the caller still parses it.
func DecodeResult ¶ added in v0.29.0
DecodeResult decodes the first JSON value of a tool result's text into v. While the KB's git sync is not clean the server appends a second block ({"last_error":"","sync_state":"pending"}) to a write tool's result and the client joins the blocks with a newline: only the first value is the answer, so a decode of the whole text ("invalid character '{' after top-level value") would call a successful write failed. Every tool-result parse of the Surveyor goes through here.
func EncodeAuthor ¶ added in v0.25.0
EncodeAuthor is author as the header value every sender writes (D904): as is when it holds only letters, digits, inner spaces and . - _ @ < > + ' ( ) , and else base64 in the SEP-2243 form. That is stricter than SEP-2243, which leaves any visible ASCII plain: the value sync writes goes through a client config, and those expand "${VAR}", "$VAR", "$(cmd)" (Crush) or "{env:VAR}" (OpenCode) in a header, so only text no config can read as a template stays plain. The encoded form itself is never plain, so a value that already reads as it is encoded again.
func Escape ¶ added in v0.28.0
Escape, EscapeCap and HasControl make text a remote party chose safe to print on a terminal; every client-side print of server-chosen text goes through them. Escape shows every rune that is not printable (a newline that forges a line, an ESC that rewrites the screen, a bidi override, a zero-width character, DEL, a C1 control) as its escape, tab excepted. Printable text, accented letters included, is untouched.
func EscapeCap ¶ added in v0.28.0
EscapeCap is Escape on at most max runes of s; a longer text ends in "...".
func HTTPClient ¶ added in v0.26.0
HTTPClient returns a copy of base whose redirects obey RedirectPolicy.
func HasControl ¶ added in v0.28.0
HasControl reports whether s holds a control character (C0, DEL, C1).
func IsLoopbackHost ¶ added in v0.26.0
IsLoopbackHost reports whether host (no port, no brackets) is the loopback interface: "localhost" (case-insensitive, trailing dot ignored) or any IP for which net.ParseIP(...).IsLoopback() holds (127.0.0.0/8, ::1, IPv4-mapped). It parses the address instead of matching a prefix: "127.0.0.1.example.com" is a DNS name, not loopback.
func IsServerHealth ¶ added in v0.29.0
IsServerHealth is the one rule for "this /health body is a Cartographer server's": status "ok" and a version. Any program can answer a 200 with {"status":"ok"}; the version is what a real server adds (a bootstrapping server carries both). setup, `service status`, the health probes behind `doctor` and the tray all read the verdict from here, so a foreign listener is told the same way everywhere (#1998).
func PerKBName ¶ added in v0.29.0
PerKBName is the KB a per-KB endpoint URL (/mcp/<kb>, behind any proxy prefix) names, and "" for any other form: /mcp, /mcp?kb=<kb>, /mcp/routed.
func RedirectPolicy ¶ added in v0.26.0
RedirectPolicy is the http.Client CheckRedirect that keeps the gate in force across redirects: Go keeps Authorization on a same-host redirect, so an https:// endpoint answering 302 to http:// would otherwise leak the token. A redirect whose target fails CheckServerURL is refused.
func RequestMeta ¶ added in v0.28.0
RequestMeta is the _meta object of one request: the revision, this client's identity and no optional capability. version is the build stamp, "unknown" when empty. `cartographer call` builds its requests with it too.
func RoutedEndpoint ¶ added in v0.29.0
RoutedEndpoint is the URL of the server's routed endpoint for a client URL of any form (/mcp, /mcp?kb=<kb>, /mcp/<kb>, /mcp/routed): the base of the server (ServerBase, a reverse proxy's prefix kept) plus the routed path the server advertises (bare, never with the proxy's prefix), with no query, because the KB is a tool argument there (WithRoutedKB) and a ?kb= on the routed mount is refused (#2149).
func ServerBase ¶ added in v0.29.0
ServerBase is the server's base URL for an MCP endpoint URL: the terminal /mcp or /mcp/routed segment, a trailing slash, the query and the fragment are dropped, so "https://host/prefix/mcp" gives a URL whose path is "/prefix". Health and AtlasURL both build on it, so the routes they derive cannot drift.
func ToolRequiresWrite ¶ added in v0.28.0
ToolRequiresWrite reports whether calling the named tool requires write access to the KB. Fail-closed: unknown tool names (and plugin tools) require write.
func UnreachableMessage ¶ added in v0.25.0
UnreachableMessage is the text of a request that never got an answer, for callers that speak HTTP themselves but must word the failure the same way (the stdio bridge, D737).
func VerifyServer ¶ added in v0.29.0
VerifyServer asks the anonymous /health of the server behind serverURL and returns nil only when it answers as a Cartographer server (IsServer). It is the check every sender of the bearer token makes first (MCPClient does it itself; the stdio bridge calls it), so the token never goes to a program that merely listens on the configured address.
Types ¶
type Health ¶ added in v0.2.0
type Health struct {
Status string `json:"status"`
Version string `json:"version"`
Ready *bool `json:"ready"`
// Build names the serving executable: the VCS revision it was built from
// or a hash of the file ("vcs:<revision>", "sha256:<hex>"), the identity
// two builds of one version differ by. Empty from a server that predates
// the field.
Build string `json:"build,omitempty"`
KBs *[]HealthKB `json:"kbs"`
// MountMode is "routed" when the server serves every KB through a single
// endpoint with the KB as a tool argument (D187). Empty — which is what a
// per-KB server and every pre-D187 server decode to — means the historical
// one-endpoint-per-KB topology. Additive and byte-compatible.
MountMode string `json:"mount_mode,omitempty"`
// RoutedPath is that endpoint's path, named by the server rather than
// assumed by the client, so the two cannot drift.
RoutedPath string `json:"routed_path,omitempty"`
// LatestVersion is a newer release the server knows of (D254). Absent
// means unknown or up to date; the server never names a command, since
// how it was deployed is not knowable from inside.
LatestVersion string `json:"latest_version,omitempty"`
// ComponentProtocol and ComponentMinProtocol are the component protocol
// window of the server (internal/componentproto); zero on a server that
// predates it. Public, so a Surveyor can refuse an unsupported server
// before its first beat.
ComponentProtocol int `json:"component_protocol,omitempty"`
ComponentMinProtocol int `json:"component_min_protocol,omitempty"`
// Bootstrapping is true only while the server is still cloning and
// indexing its KBs (D348). Health turns it into an error: the answer
// carries no KB list, and reading it as "zero KBs" would let sync prune
// managed files against an empty list.
Bootstrapping bool `json:"bootstrapping,omitempty"`
// SkippedKBs are the KBs the server was told to serve and could not mount
// (a moved path, an unreachable remote), with the reason (#1963).
SkippedKBs []SkippedKB `json:"skipped_kbs,omitempty"`
}
Health is the additive subset of the server's /health response that clients use to distinguish a reachable-but-unusable empty multi-KB server from one that can accept MCP requests. Ready and KBs are pointers so callers can distinguish an older server that did not send either field from an explicit false/empty value.
type HealthCapability ¶ added in v0.9.0
HealthCapability is one gate's state plus the setting controlling it.
type HealthKB ¶ added in v0.2.0
type HealthKB struct {
Name string `json:"name"`
ToolPrefix string `json:"tool_prefix,omitempty"`
// Capabilities is each per-KB gate's state and the configuration key that
// controls it (D151). Optional and additive, like ToolPrefix: an older
// server simply omits it and a client must stay silent rather than infer.
Capabilities map[string]HealthCapability `json:"capabilities,omitempty"`
// Push is set while the KB's push failed or its commits stay unpushed past
// a few minutes; absent otherwise and on a server that predates it.
Push *HealthPush `json:"push,omitempty"`
}
HealthKB is the additive per-KB item returned by a MultiKB server's /health endpoint. A single-KB (and older) server omits the kbs field altogether, which callers distinguish through Health.KBs being nil. ToolPrefix (D120) is the effective, already-sanitised tool-name prefix (mcpserver.KBInfo.ToolPrefix) this KB's tools are registered under; empty means unprefixed, which is also what an older server (that never sent the field at all) decodes to — additive, byte-compatible with pre-D120 servers/clients.
func (*HealthKB) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON accepts the current {"name":"..."} health shape and the short string array used by early multi-KB builds. Keeping both shapes makes client enumeration additive in the same way the optional kbs field is.
type HealthPush ¶ added in v0.29.0
type HealthPush struct {
State string `json:"push_state"`
UnpushedCommits int `json:"unpushed_commits"`
// Remedy is one line of the git error, free text from the server.
Remedy string `json:"remedy,omitempty"`
}
HealthPush is the push state of one KB as /health reports it.
func (HealthPush) Line ¶ added in v0.29.0
func (p HealthPush) Line() string
Line words the push state for a human: "3 commits not pushed, <remedy>".
type HeartbeatAnswer ¶ added in v0.29.0
type HeartbeatAnswer struct {
Accepted []string `json:"accepted"`
KBs map[string]struct {
LastActivityAt *time.Time `json:"last_activity_at"`
} `json:"kbs"`
ActivityKnown bool `json:"activity_known"`
ServerStartedAt time.Time `json:"server_started_at"`
Now time.Time `json:"now"`
SettingsWanted bool `json:"settings_wanted"`
RunsWanted bool `json:"runs_wanted"`
Protocol int `json:"protocol"`
MinProtocol int `json:"min_protocol"`
}
HeartbeatAnswer is the answer of the component heartbeat: the idle signal of each accepted KB, whether the server wants the settings report, and the protocol window the server speaks (zero on a server that predates the field).
type MCPClient ¶
type MCPClient struct {
ServerURL string // e.g. "http://127.0.0.1:39273/mcp"
// AllowInsecureHTTP lets requests go to a non-loopback http:// URL (see CheckServerURL).
AllowInsecureHTTP bool
Token string // bearer token, empty = no Authorization header
// TokenEnv names the environment variable Token was read from, so a 401
// can say which variable to look at (D222). Empty when the caller has no
// such variable, and the 401 message is then exactly what it was before.
TokenEnv string
KB string // optional KB name; appended as ?kb=<KB> (multi-KB server routing, see httpserver.go)
HTTP *http.Client
// Version identifies this client build in the server's roster. Empty is
// reported as "unknown" rather than refused: a roster row with no version
// is still useful, and a missing build stamp must not stop a sync.
Version string
// Author is who this client writes as, "Name <email>" (D904), sent on
// tools/call only. Empty sends nothing and the server authors the write as
// the token.
Author string
// contains filtered or unexported fields
}
MCPClient is a minimal JSON-RPC 2.0 client for the MCP `tools/call` method.
func (*MCPClient) Call ¶
Call invokes an MCP tool via tools/call and preserves all text content blocks.
func (*MCPClient) CallContext ¶ added in v0.28.0
func (c *MCPClient) CallContext(ctx context.Context, tool string, args any) (json.RawMessage, error)
CallContext is Call under a context: when it ends the request is abandoned, so a caller that reports a deadline does not leave a write running.
func (*MCPClient) CallTool ¶ added in v0.29.0
func (c *MCPClient) CallTool(tool string, args any) (ToolOutput, error)
CallTool invokes a tool like Call, but returns the result text and the tool's own isError flag so a caller can hand a tool-level refusal back to a model. Transport and JSON-RPC failures remain *RemoteError.
func (*MCPClient) Health ¶ added in v0.2.0
Health fetches GET /health for the configured MCP endpoint. serverURL normally ends in /mcp; only that terminal path segment is stripped, leaving deployments whose endpoint is rooted elsewhere intact. Like Ping, timeout applies only to this call and does not mutate the client shared by later sync_pull requests.
TRAP: /health is public, so the first request never carries the token: a process that merely listens on the configured port must not receive it. Only when that anonymous answer has a Cartographer server's shape (IsServer) and the client has a token is /health asked again with it, because the KB list follows the caller's token (D1096). The authenticated request follows no redirect: Go keeps Authorization on a same-host one.
func (*MCPClient) Heartbeat ¶ added in v0.29.0
Heartbeat posts a surveyor's declaration (a JSON-encodable object that carries its own `protocol`) and returns the server's answer. A server too old for the route answers 404, an error the surveyor ignores; one that refuses the surveyor's protocol answers 426, a *RemoteError with HTTPStatus 426 and the server's numbers in ServerProtocol and ServerMinProtocol.
func (*MCPClient) ListTools ¶ added in v0.28.0
ListTools returns every tool of tools/list (the server filters it per token), following nextCursor. ReadOnly is the server's own readOnlyHint, so the classification is never copied here; an absent annotation is false. A tool without a name is skipped: nothing can call it.
func (*MCPClient) ListToolsContext ¶ added in v0.28.0
ListToolsContext is ListTools under a context.
func (*MCPClient) Ping ¶
Ping performs a minimal round trip against the server to check reachability and, when a token is set, that it's accepted — without invoking any tool. It uses "server/discover": the "ping" method it used before is gone in the 2026-07-28 revision (D128), while server/discover is mandatory on any conformant server and just as cheap — no KB access, no tool lookup. The Go name stays Ping because reachability, not the wire method, is what callers ask for. timeout bounds this single call independently of the client's normal HTTP timeout (30s), so a probe before a full connect (D64) fails fast instead of hanging. Returns nil on success, ErrUnauthorized on HTTP 401, or the underlying network/timeout error otherwise.
The request carries the 2026-07-28 metadata like every other: server/discover only exists in that revision, so a handshake-era request naming it is an unknown method.
func (*MCPClient) ReportClientSettings ¶ added in v0.25.0
ReportClientSettings posts this machine's client settings to the server, so the Atlas can show the viewer their own client (D818). The report is a JSON object; the component and the protocol are added here. Best-effort like ReportUsage.
func (*MCPClient) ReportRuns ¶ added in v0.29.0
ReportRuns posts a surveyor's finished runs and current alarms (a JSON-encodable object that carries its own `protocol`). Errors are mapped as on the heartbeat: 404 and 426 are *RemoteError.
func (*MCPClient) ReportSurveyorSettings ¶ added in v0.29.0
ReportSurveyorSettings posts a surveyor's settings report. Best-effort like ReportClientSettings.
func (*MCPClient) ReportUsage ¶ added in v0.19.0
ReportUsage posts a usage report (a JSON-encodable list of entries) for one KB to the server's component usage route (D326). Like Health, it derives the origin from the MCP endpoint URL and applies timeout to this call only. It is best-effort by design — the caller logs and goes on — so any non-2xx is an error the caller is free to ignore. Against a 0.28 server (404 on the component route) it falls back to /api/usage, see reportReleased.
func (*MCPClient) UnauthorizedError ¶ added in v0.25.0
UnauthorizedError is the cause of a 401 for this client's credential, naming the environment variable when there is one (D222).
func (*MCPClient) WithAuthor ¶ added in v0.25.0
WithAuthor returns a copy of the client that names who its tool calls write as. The caller resolves it; nothing is read from git or the config here.
func (*MCPClient) WithHTTPTimeout ¶ added in v0.29.0
WithHTTPTimeout returns a copy of the client whose HTTP calls time out after d (the default is 30 s, and calls take no context). The surveyor writes its closing entries with a short one so that a shutdown fits the orchestrator's grace period.
func (*MCPClient) WithInsecureHTTP ¶ added in v0.26.0
WithInsecureHTTP returns a copy of the client that does (or does not) accept a non-loopback http:// server URL. The default refuses it (CheckServerURL).
func (*MCPClient) WithKB ¶
WithKB returns a copy of the client scoped to the given KB name (multi-KB server: appends ?kb=<name> to the request URL, see MultiKBServer.Handler in httpserver.go). An empty name targets the server's default single-KB endpoint.
func (*MCPClient) WithRoutedKB ¶ added in v0.29.0
WithRoutedKB returns a copy of the client for one KB of a routed endpoint (D187, ServerURL on /mcp/routed): the KB is not in the URL, which names the perimeter (?kbs=), but a `kb` argument this client adds to every tool call, and hides from the tool list so a model never has to supply it (#2088).
func (*MCPClient) WithTokenEnv ¶ added in v0.14.0
WithTokenEnv returns a copy of the client that knows which environment variable its token came from. Only the message of a 401 changes; nothing is read from the environment here, and an empty name is the legacy behaviour.
type RemoteError ¶ added in v0.4.0
type RemoteError struct {
State RemoteState
Code string
Message string
Cause error
// HTTPStatus is the response status of a RemoteError that carries one
// (CodeHTTPFailed from an answering server), zero otherwise. It lets a
// caller tell a refused credential (403) from a transport failure (#1299).
HTTPStatus int
// RPCCode is the JSON-RPC error code of a CodeMCPFailed that came from an
// "error" object (for example -32602, invalid params), zero otherwise. It
// lets a caller tell a refused argument from a failure without parsing
// Message.
RPCCode int
// ServerProtocol and ServerMinProtocol are the component protocol window a
// server named when it refused the request with 426 (protocol_unsupported);
// zero otherwise.
ServerProtocol, ServerMinProtocol int
}
RemoteError is returned by MCPClient's do/Call/Health/Ping for every failure that involves the network or the remote server's response. Local-only errors that never reach the network (an invalid server URL, a JSON marshal failure) are not wrapped — only genuinely remote-shaped failures are, so errors.As(err, &client.RemoteError{}) reliably means "we talked to (or tried to talk to) the network for this call".
func (*RemoteError) Error ¶ added in v0.4.0
func (e *RemoteError) Error() string
func (*RemoteError) Unwrap ¶ added in v0.4.0
func (e *RemoteError) Unwrap() error
Unwrap exposes Cause so errors.Is/As (including the pre-D120 errors.Is(err, ErrUnauthorized) check callers already rely on) keeps working through a RemoteError.
type RemoteState ¶ added in v0.4.0
type RemoteState string
RemoteState classifies a RemoteError as either the server being completely unreachable/unusable (RemoteUnavailable: DNS/connection failure, HTTP non-2xx, 401) or reached-but-this-call-failed (RemoteFailed: a malformed JSON-RPC response, a JSON-RPC error object, or a tool result with isError:true — e.g. an unqualified tool name after a healthy discovery, the D120 regression this taxonomy exists to distinguish). Callers (cmd/cartographer's status) render on this distinction instead of a single hardcoded "server unreachable".
const ( RemoteFailed RemoteState = "error" )
type RunsAnswer ¶ added in v0.29.0
RunsAnswer is the answer of the runs report.
type SkippedKB ¶ added in v0.29.0
type SkippedKB struct {
Name string `json:"name"`
Reason string `json:"reason"`
Retrying bool `json:"retrying,omitempty"`
}
SkippedKB is one entry of Health.SkippedKBs.
type ToolInfo ¶ added in v0.28.0
type ToolInfo struct {
Name string
ReadOnly bool
Description string
InputSchema json.RawMessage
}
ToolInfo is one tool of tools/list: its name, whether the server annotates it read-only (what a plugin's kb.call needs), and the description and input schema a surveyor hands to a model. InputSchema is passed through untouched.
type ToolOutput ¶ added in v0.29.0
ToolOutput is a tool result that keeps the tool-level isError flag instead of turning it into a Go error (see CallTool).