Documentation
¶
Overview ¶
Package lock exposes the Dapr distributed lock building block as MCP tools.
Index ¶
Constants ¶
const ( // RPCTimeout bounds each call to the lock store. RPCTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func RegisterTools ¶
func RegisterTools(server *mcp.Server, client LockClient, metrics *telemetry.ToolMetrics)
RegisterTools registers the acquire_lock and release_lock tools on server. metrics may be nil.
Types ¶
type AcquireLockArgs ¶
type AcquireLockArgs struct {
StoreName string `json:"storeName" jsonschema:"The name of the Dapr lock store component (e.g., 'redis-lock')."`
ResourceID string `json:"resourceID" jsonschema:"The unique name of the resource to lock (e.g., 'inventory-update-lock')."`
LockOwner string `json:"lockOwner" jsonschema:"A unique identifier for the entity trying to acquire the lock (e.g., 'ai-agent-42')."`
ExpiryInSeconds int32 `` /* 199-byte string literal not displayed */
}
AcquireLockArgs are the arguments of the acquire_lock tool.
type LockClient ¶
type LockClient interface {
TryLockAlpha1(ctx context.Context, storeName string, req *dapr.LockRequest) (*dapr.LockResponse, error)
UnlockAlpha1(ctx context.Context, storeName string, req *dapr.UnlockRequest) (*dapr.UnlockResponse, error)
}
LockClient defines the interface for lock operations.
type ReleaseLockArgs ¶
type ReleaseLockArgs struct {
StoreName string `json:"storeName" jsonschema:"The name of the Dapr lock store component."`
ResourceID string `json:"resourceID" jsonschema:"The unique name of the resource whose lock should be released."`
LockOwner string `json:"lockOwner" jsonschema:"The unique identifier of the entity that currently holds the lock."`
}
ReleaseLockArgs are the arguments of the release_lock tool.