lock

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lock exposes the Dapr distributed lock building block as MCP tools.

Index

Constants

View Source
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.

func ToolNames added in v0.0.2

func ToolNames() []string

ToolNames returns the names of the tools RegisterTools adds.

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.

Jump to

Keyboard shortcuts

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