handlers

package
v0.59.13 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GoProxyURL is the base URL for the Go proxy API
	GoProxyURL = "https://proxy.golang.org"
)
View Source
const (
	// MavenCentralURL is the base URL for the Maven Central API
	MavenCentralURL = "https://search.maven.org/solrsearch/select"
)
View Source
const (
	// NpmRegistryURL is the base URL for the npm registry
	NpmRegistryURL = "https://registry.npmjs.org"
)
View Source
const (
	// PyPIURL is the base URL for the PyPI API
	PyPIURL = "https://pypi.org/pypi"
)

Variables

This section is empty.

Functions

func CleanVersion

func CleanVersion(version string) string

CleanVersion removes any leading version prefix (^, ~, >, =, <, etc.) from a version string

func CompareVersions

func CompareVersions(v1, v2 string) (int, error)

CompareVersions compares two version strings Returns:

-1 if v1 < v2
 0 if v1 == v2
 1 if v1 > v2

func ExtractMajorVersion

func ExtractMajorVersion(version string) (int, error)

ExtractMajorVersion extracts the major version from a version string

func FuzzyMatch

func FuzzyMatch(str, query string) bool

FuzzyMatch performs a simple fuzzy match between a string and a query

func IntPtr

func IntPtr(i int) *int

IntPtr returns a pointer to the given int

func MakeRequest

func MakeRequest(client HTTPClient, method, url string, headers map[string]string) ([]byte, error)

MakeRequest makes an HTTP request and returns the response body

func MakeRequestWithLogger

func MakeRequestWithLogger(client HTTPClient, logger *logrus.Logger, method, url string, headers map[string]string) ([]byte, error)

MakeRequestWithLogger makes an HTTP request with logging and returns the response body

func NewToolResultJSON

func NewToolResultJSON(data any) (*mcp.CallToolResult, error)

NewToolResultJSON creates a new tool result with JSON content

func ParseVersion

func ParseVersion(version string) (major, minor, patch int, err error)

ParseVersion parses a version string into major, minor, and patch components

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to the given string

Types

type BedrockHandler

type BedrockHandler struct {
	// contains filtered or unexported fields
}

BedrockHandler handles AWS Bedrock model checking

func NewBedrockHandler

func NewBedrockHandler(logger *logrus.Logger, cache *sync.Map) *BedrockHandler

NewBedrockHandler creates a new Bedrock handler

func (*BedrockHandler) GetLatestVersion

func (h *BedrockHandler) GetLatestVersion(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersion gets information about AWS Bedrock models

type BedrockModel

type BedrockModel struct {
	Provider           string   `json:"provider"`
	ModelName          string   `json:"modelName"`
	ModelID            string   `json:"modelId"`
	RegionsSupported   []string `json:"regionsSupported"`
	InputModalities    []string `json:"inputModalities"`
	OutputModalities   []string `json:"outputModalities"`
	StreamingSupported bool     `json:"streamingSupported"`
}

BedrockModel represents an AWS Bedrock model

type BedrockModelSearchResult

type BedrockModelSearchResult struct {
	Models     []BedrockModel `json:"models"`
	TotalCount int            `json:"totalCount"`
}

BedrockModelSearchResult represents search results for AWS Bedrock models

type DockerHandler

type DockerHandler struct {
	// contains filtered or unexported fields
}

DockerHandler handles Docker image version checking

func NewDockerHandler

func NewDockerHandler(logger *logrus.Logger, cache *sync.Map) *DockerHandler

NewDockerHandler creates a new Docker handler

func (*DockerHandler) GetLatestVersion

func (h *DockerHandler) GetLatestVersion(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersion gets information about Docker image tags

type DockerHubTagsResponse

type DockerHubTagsResponse struct {
	Count    int    `json:"count"`
	Next     string `json:"next"`
	Previous string `json:"previous"`
	Results  []struct {
		Name        string    `json:"name"`
		FullSize    int64     `json:"full_size"`
		LastUpdated time.Time `json:"last_updated"`
		Images      []struct {
			Digest       string `json:"digest"`
			Architecture string `json:"architecture"`
			OS           string `json:"os"`
			Size         int64  `json:"size"`
		} `json:"images"`
	} `json:"results"`
}

DockerHubTagsResponse represents a response from the Docker Hub API

type DockerImageQuery

type DockerImageQuery struct {
	Image          string   `json:"image"`
	Registry       string   `json:"registry,omitempty"`
	CustomRegistry string   `json:"customRegistry,omitempty"`
	Limit          int      `json:"limit,omitempty"`
	FilterTags     []string `json:"filterTags,omitempty"`
	IncludeDigest  bool     `json:"includeDigest,omitempty"`
}

DockerImageQuery represents a query for Docker image tags

type DockerImageVersion

type DockerImageVersion struct {
	Name     string  `json:"name"`
	Tag      string  `json:"tag"`
	Registry string  `json:"registry"`
	Digest   *string `json:"digest,omitempty"`
	Created  *string `json:"created,omitempty"`
	Size     *string `json:"size,omitempty"`
}

DockerImageVersion represents version information for a Docker image

type GHCRTagsResponse

type GHCRTagsResponse struct {
	Tags []string `json:"tags"`
}

GHCRTagsResponse represents a response from the GitHub Container Registry API

type GitHubAction

type GitHubAction struct {
	Owner          string  `json:"owner"`
	Repo           string  `json:"repo"`
	CurrentVersion *string `json:"currentVersion,omitempty"`
}

GitHubAction represents a GitHub Action

type GitHubActionVersion

type GitHubActionVersion struct {
	Owner          string  `json:"owner"`
	Repo           string  `json:"repo"`
	CurrentVersion *string `json:"currentVersion,omitempty"`
	LatestVersion  string  `json:"latestVersion"`
	PublishedAt    *string `json:"publishedAt,omitempty"`
	URL            *string `json:"url,omitempty"`
}

GitHubActionVersion represents version information for a GitHub Action

type GitHubActionsHandler

type GitHubActionsHandler struct {
	// contains filtered or unexported fields
}

GitHubActionsHandler handles GitHub Actions version checking

func NewGitHubActionsHandler

func NewGitHubActionsHandler(logger *logrus.Logger, cache *sync.Map) *GitHubActionsHandler

NewGitHubActionsHandler creates a new GitHub Actions handler

func (*GitHubActionsHandler) GetLatestVersion

func (h *GitHubActionsHandler) GetLatestVersion(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersion gets the latest version of GitHub Actions

type GitHubRelease

type GitHubRelease struct {
	TagName     string `json:"tag_name"`
	Name        string `json:"name"`
	PublishedAt string `json:"published_at"`
	Draft       bool   `json:"draft"`
	Prerelease  bool   `json:"prerelease"`
	HTMLURL     string `json:"html_url"`
}

GitHubRelease represents a GitHub release

type GitHubReleaseResponse

type GitHubReleaseResponse []struct {
	TagName     string `json:"tag_name"`
	Name        string `json:"name"`
	Draft       bool   `json:"draft"`
	Prerelease  bool   `json:"prerelease"`
	PublishedAt string `json:"published_at"`
}

GitHubReleaseResponse represents a response from the GitHub API for releases

type GoHandler

type GoHandler struct {
	// contains filtered or unexported fields
}

GoHandler handles Go package version checking

func NewGoHandler

func NewGoHandler(logger *logrus.Logger, cache *sync.Map) *GoHandler

NewGoHandler creates a new Go handler

func (*GoHandler) GetLatestVersion

func (h *GoHandler) GetLatestVersion(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersion gets the latest version of Go packages

type GoModule

type GoModule struct {
	Module  string      `json:"module"`
	Require []GoRequire `json:"require,omitempty"`
	Replace []GoReplace `json:"replace,omitempty"`
}

GoModule represents a Go module in a go.mod file

type GoModuleInfo

type GoModuleInfo struct {
	Version  string   `json:"Version"`
	Time     string   `json:"Time"`
	Versions []string `json:"Versions"`
}

GoModuleInfo represents information about a Go module

type GoReplace

type GoReplace struct {
	Old     string `json:"old"`
	New     string `json:"new"`
	Version string `json:"version,omitempty"`
}

GoReplace represents a replacement in a go.mod file

type GoRequire

type GoRequire struct {
	Path    string `json:"path"`
	Version string `json:"version,omitempty"`
}

GoRequire represents a required dependency in a go.mod file

type GradleDependency

type GradleDependency struct {
	Configuration string `json:"configuration"`
	Group         string `json:"group"`
	Name          string `json:"name"`
	Version       string `json:"version,omitempty"`
}

GradleDependency represents a dependency in a Gradle build.gradle file

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface for making HTTP requests

var (
	// DefaultHTTPClient is the default HTTP client
	DefaultHTTPClient HTTPClient = &http.Client{
		Timeout: 30 * time.Second,
	}
)

type JavaHandler

type JavaHandler struct {
	// contains filtered or unexported fields
}

JavaHandler handles Java package version checking

func NewJavaHandler

func NewJavaHandler(logger *logrus.Logger, cache *sync.Map) *JavaHandler

NewJavaHandler creates a new Java handler

func (*JavaHandler) GetLatestVersionFromGradle

func (h *JavaHandler) GetLatestVersionFromGradle(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersionFromGradle gets the latest version of Java packages from Gradle

func (*JavaHandler) GetLatestVersionFromMaven

func (h *JavaHandler) GetLatestVersionFromMaven(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersionFromMaven gets the latest version of Java packages from Maven

type MavenDependency

type MavenDependency struct {
	GroupID    string `json:"groupId"`
	ArtifactID string `json:"artifactId"`
	Version    string `json:"version,omitempty"`
	Scope      string `json:"scope,omitempty"`
}

MavenDependency represents a dependency in a Maven pom.xml file

type MavenSearchResponse

type MavenSearchResponse struct {
	Response struct {
		NumFound int `json:"numFound"`
		Docs     []struct {
			ID         string   `json:"id"`
			GroupID    string   `json:"g"`
			ArtifactID string   `json:"a"`
			Version    string   `json:"v"`
			Versions   []string `json:"versions,omitempty"`
		} `json:"docs"`
	} `json:"response"`
}

MavenSearchResponse represents a response from the Maven Central API

type NpmDependencies

type NpmDependencies map[string]string

NpmDependencies represents dependencies in a package.json file

type NpmHandler

type NpmHandler struct {
	// contains filtered or unexported fields
}

NpmHandler handles npm package version checking

func NewNpmHandler

func NewNpmHandler(logger *logrus.Logger, cache *sync.Map) *NpmHandler

NewNpmHandler creates a new npm handler

func (*NpmHandler) GetLatestVersion

func (h *NpmHandler) GetLatestVersion(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersion gets the latest version of npm packages

type NpmPackageInfo

type NpmPackageInfo struct {
	Name     string            `json:"name"`
	DistTags map[string]string `json:"dist-tags"`
	Versions map[string]struct {
		Version string `json:"version"`
	} `json:"versions"`
}

NpmPackageInfo represents information about an npm package

type PackageVersion

type PackageVersion struct {
	Name           string  `json:"name"`
	CurrentVersion *string `json:"currentVersion,omitempty"`
	LatestVersion  string  `json:"latestVersion"`
	Registry       string  `json:"registry"`
	Skipped        bool    `json:"skipped,omitempty"`
	SkipReason     string  `json:"skipReason,omitempty"`
}

PackageVersion represents version information for a package

type PyPIPackageInfo

type PyPIPackageInfo struct {
	Info struct {
		Name    string `json:"name"`
		Version string `json:"version"`
	} `json:"info"`
	Releases map[string][]struct {
		PackageType string `json:"packagetype"`
	} `json:"releases"`
}

PyPIPackageInfo represents information about a PyPI package

type PyProjectDependencies

type PyProjectDependencies struct {
	Dependencies         map[string]string            `json:"dependencies,omitempty"`
	OptionalDependencies map[string]map[string]string `json:"optional-dependencies,omitempty"`
	DevDependencies      map[string]string            `json:"dev-dependencies,omitempty"`
}

PyProjectDependencies represents dependencies in a pyproject.toml file

type PythonHandler

type PythonHandler struct {
	// contains filtered or unexported fields
}

PythonHandler handles Python package version checking

func NewPythonHandler

func NewPythonHandler(logger *logrus.Logger, cache *sync.Map) *PythonHandler

NewPythonHandler creates a new Python handler

func (*PythonHandler) GetLatestVersionFromPyProject

func (h *PythonHandler) GetLatestVersionFromPyProject(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersionFromPyProject gets the latest version of Python packages from pyproject.toml

func (*PythonHandler) GetLatestVersionFromRequirements

func (h *PythonHandler) GetLatestVersionFromRequirements(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersionFromRequirements gets the latest version of Python packages from requirements.txt

type SwiftDependency

type SwiftDependency struct {
	URL         string `json:"url"`
	Version     string `json:"version,omitempty"`
	Requirement string `json:"requirement,omitempty"`
}

SwiftDependency represents a dependency in a Swift Package.swift file

type SwiftHandler

type SwiftHandler struct {
	// contains filtered or unexported fields
}

SwiftHandler handles Swift package version checking

func NewSwiftHandler

func NewSwiftHandler(logger *logrus.Logger, cache *sync.Map) *SwiftHandler

NewSwiftHandler creates a new Swift handler

func (*SwiftHandler) GetLatestVersion

func (h *SwiftHandler) GetLatestVersion(ctx context.Context, args map[string]any) (*mcp.CallToolResult, error)

GetLatestVersion gets the latest version of Swift packages

type VersionConstraint

type VersionConstraint struct {
	MajorVersion   *int `json:"majorVersion,omitempty"`
	ExcludePackage bool `json:"excludePackage,omitempty"`
}

VersionConstraint represents constraints for package version updates

type VersionConstraints

type VersionConstraints map[string]VersionConstraint

VersionConstraints maps package names to their constraints

Jump to

Keyboard shortcuts

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