legacyhint

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package legacyhint detects the deprecated ToolHive registry format and supplies a single migration message used by every parser/validator entry point. Lives in its own leaf package so pkg/registry and pkg/config can both import it without creating an import cycle (pkg/registry imports pkg/config).

Index

Constants

View Source
const MigrationMessage = "registry file appears to be in the legacy ToolHive format; " +
	"run `thv registry convert --in <path> --in-place` to migrate to the upstream MCP format"

MigrationMessage is the user-facing text returned when a legacy ToolHive registry file is detected. Kept identical across the runtime parser, set-registry-file, set-registry-url, and remote provider validation paths.

Variables

This section is empty.

Functions

func IsUpstream

func IsUpstream(data []byte) bool

IsUpstream reports whether the JSON document appears to use the upstream registry format. The discriminator is a top-level "data" object — only the upstream format wraps servers inside it. The "$schema" key alone is not sufficient because the legacy format also includes one.

func Looks

func Looks(data []byte) bool

Looks reports whether the JSON document has top-level "servers", "remote_servers", or "groups" — the markers of the legacy ToolHive registry layout. The upstream format wraps these under a top-level "data" object, so a match here means the input is legacy (or close enough that emitting the migration hint is more useful than a generic decode error).

Used to short-circuit with a migration hint instead of the misleading "no servers" error that Go's JSON decoder produces when legacy fields are silently dropped during unmarshal into UpstreamRegistry.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL