Documentation
¶
Overview ¶
Package azdextutil provides shared utilities for building azd extensions that integrate with the Azure Developer CLI extension framework.
It reduces boilerplate for common patterns like metadata generation, listen command creation, MCP server setup, and distributed tracing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProjectDir ¶
GetProjectDir returns the project directory from the specified environment variable, falling back to the current working directory. Validates the path is safe.
func ValidateShellName ¶
ValidateShellName validates that a shell name is one of the known safe values.
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter wraps golang.org/x/time/rate to provide token-bucket rate limiting for MCP tool calls.
func NewRateLimiter ¶
func NewRateLimiter(maxTokens float64, refillRate float64) *RateLimiter
NewRateLimiter creates a rate limiter with the specified burst size and refill rate. For example, NewRateLimiter(10, 1.0) allows 10 burst calls and refills 1 token/second.
func (*RateLimiter) Allow ¶
func (r *RateLimiter) Allow() bool
Allow returns true if a request is allowed, consuming one token.
func (*RateLimiter) CheckRateLimit ¶
func (r *RateLimiter) CheckRateLimit(toolName string) error
CheckRateLimit checks the rate limiter and returns an error if the limit is exceeded.