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 Markdown summary with the ID, title, truncated public key, owner, and creation timestamp.
Types ¶
type GetByFingerprintInput ¶
type GetByFingerprintInput struct {
Fingerprint string `json:"fingerprint" jsonschema:"SSH key fingerprint (e.g. SHA256:abc123 or MD5:aa:bb:cc),required"`
}
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"`
User UserOutput `json:"user"`
}
Output represents an SSH key with its associated user.
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.
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.