Documentation
¶
Overview ¶
Package keys implements MCP tools for GitLab SSH key operations.
The package wraps the GitLab Keys API:
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionSpecs ¶
func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
ActionSpecs returns canonical specs for SSH key lookup actions exposed as MCP tools. The two read routes (get by ID, get by fingerprint) are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).
func FormatMarkdown ¶
func FormatMarkdown(out Output) *mcp.CallToolResult
FormatMarkdown renders a key as Markdown wrapped in an mcp.CallToolResult. It is registered as the package's formatter for Output.
func FormatMarkdownString ¶
FormatMarkdownString renders a key as a card: the identity, the truncated public key, when it expires and when it was last used, and the owning user as a nested object.
Types ¶
type GetByFingerprintInput ¶
type GetByFingerprintInput struct {
Fingerprint string `` /* 229-byte string literal not displayed */
}
GetByFingerprintInput is the input for getting a key by fingerprint.
type GetByIDInput ¶
type GetByIDInput struct {
KeyID int64 `json:"key_id" jsonschema:"SSH key ID,required"`
}
GetByIDInput is the input for getting a key by its ID.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int64 `json:"id"`
Title string `json:"title"`
Key string `json:"key"`
CreatedAt string `json:"created_at,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
LastUsedAt string `json:"last_used_at,omitempty"`
UsageType string `json:"usage_type,omitempty"`
User UserOutput `json:"user"`
}
Output represents an SSH key with its associated user, as gl.Key decodes it, the expiry, last use and usage type lib/api/entities/ssh_key.rb sends on every key included.
func GetKeyByFingerprint ¶
func GetKeyByFingerprint(ctx context.Context, client *gitlabclient.Client, input GetByFingerprintInput) (Output, error)
GetKeyByFingerprint retrieves an SSH key by its fingerprint via the GitLab admin Keys API (GET /keys). The fingerprint may be in the modern SHA256:base64 form or the legacy MD5 hex-pairs form, and is sent in the form GitLab finds a key by ([storedFingerprint]).
func GetKeyWithUser ¶
func GetKeyWithUser(ctx context.Context, client *gitlabclient.Client, input GetByIDInput) (Output, error)
GetKeyWithUser retrieves an SSH key and its owning user via the GitLab admin Keys API (GET /keys/:key_id). Requires administrator access on self-managed GitLab instances.
type UserOutput ¶
type UserOutput struct {
ID int64 `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
}
UserOutput represents the user associated with a key.