Documentation
¶
Overview ¶
Package metadata exposes the Dapr sidecar's component inventory as the get_components MCP tool.
Index ¶
Constants ¶
const ( TypePrefixState = "state." TypePrefixPubSub = "pubsub." TypePrefixBindings = "bindings." TypePrefixConversation = "conversation." TypePrefixSecretStores = "secretstores." TypePrefixLock = "lock." TypePrefixCrypto = "crypto." )
Dapr component type prefixes of the building blocks this server exposes.
Variables ¶
This section is empty.
Functions ¶
func RegisterTools ¶
func RegisterTools(server *mcp.Server, client MetadataClient, metrics *telemetry.ToolMetrics, opts ...Option)
RegisterTools registers the get_components tool on server. metrics may be nil.
Types ¶
type ComponentInfo ¶
type ComponentInfo struct {
Name string `json:"name" jsonschema:"The unique name of the component."`
Type string `json:"type" jsonschema:"The type of the component (e.g., state.redis, pubsub.redis)."`
Version string `json:"version,omitempty" jsonschema:"The version of the Component (e.g., v1)."`
Capabilities []string `json:"capabilities" jsonschema:"The capabilities of the Component."`
}
ComponentInfo describes one Dapr component loaded in the sidecar.
func GetLiveComponentList ¶
func GetLiveComponentList(ctx context.Context, client MetadataClient) ([]ComponentInfo, error)
GetLiveComponentList asks the sidecar for its registered components and returns those belonging to a building block this server exposes. The result is never nil, so it marshals as an empty JSON array.
type ComponentListWrapper ¶
type ComponentListWrapper struct {
Components []ComponentInfo `json:"components" jsonschema:"A list of Dapr components found in the sidecar."`
}
ComponentListWrapper is the structured result of the get_components tool.
type ComponentsObserver ¶ added in v0.0.2
type ComponentsObserver func() func([]ComponentInfo)
ComponentsObserver is called before each get_components fetch from the sidecar. If the fetch succeeds, the function it returns is called with the component list. Starting before the fetch lets the observer order the results of concurrent fetches.
type MetadataClient ¶
type MetadataClient interface {
GetMetadata(ctx context.Context) (*dapr.GetMetadataResponse, error)
}
MetadataClient defines the interface for metadata operations.
type Option ¶ added in v0.0.2
type Option func(*handler)
Option configures the get_components tool.
func WithComponentsObserver ¶ added in v0.0.2
func WithComponentsObserver(observe ComponentsObserver) Option
WithComponentsObserver tells observe about each get_components call, so the caller can react to components the sidecar has loaded or unloaded since the last call.