azdextutil

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 5 Imported by: 0

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

func GetProjectDir(envVar string) (string, error)

GetProjectDir returns the project directory from the specified environment variable, falling back to the current working directory. Validates the path is safe.

func ValidateShellName

func ValidateShellName(shell string) error

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.

Jump to

Keyboard shortcuts

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