Documentation
¶
Overview ¶
Package settings implements MCP tools for GitLab instance application settings.
The package wraps the GitLab Application settings API:
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatGetMarkdown ¶
func FormatGetMarkdown(out GetOutput) *mcp.CallToolResult
FormatGetMarkdown renders the application settings as a card.
func FormatUpdateMarkdown ¶
func FormatUpdateMarkdown(out UpdateOutput) *mcp.CallToolResult
FormatUpdateMarkdown renders the settings an update returned as the same card: an update answers with the object, so it is a card like the read.
Types ¶
type GetInput ¶
type GetInput struct{}
GetInput is the input for getting application settings (no parameters needed).
type GetOutput ¶
type GetOutput struct {
toolutil.HintableOutput
Settings map[string]any `json:"settings,omitempty"`
}
GetOutput contains the application settings object GitLab answered with, as a JSON map keyed the way the instance spells it. The map is left out rather than written as null when there is none, since the output schema types it as an object and null fails it.
func Get ¶
func Get(ctx context.Context, client *gitlabclient.Client, _ GetInput) (output GetOutput, err error)
Get retrieves the current application settings (admin-only).
The map is decoded from the captured response (ADR-0021) rather than from the settings struct client-go decoded, because this is the one endpoint whose whole value is "tell me everything this instance has set" and that struct is a model of the settings rather than the settings. Measured against the pinned live record (GitLab 19.3.1-ee), the entity exposes 648 field names and client-go's Settings carries 424: re-encoding the struct dropped 253 of the keys the instance sent and, since one field of the struct has omitempty, added 29 keys it never mentioned, each at a plausible zero value. So a model asking "is abuse notification configured?" read an empty string GitLab had not said anything about, and a setting newer than the SDK's struct answered "GitLab does not have that setting".
The SDK call is unchanged, so the route, the options and the retries stay what client-go makes them, and its own decode still refuses a body that is not the settings object before this reads the same bytes.
type UpdateInput ¶
UpdateInput is the input for updating application settings. Settings is a map of setting keys to their new values, matching the JSON field names from the GitLab API (snake_case).
type UpdateOutput ¶
type UpdateOutput struct {
toolutil.HintableOutput
Settings map[string]any `json:"settings,omitempty"`
}
UpdateOutput contains the application settings object GitLab answered the update with, keyed the way the instance spells it.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (output UpdateOutput, err error)
Update modifies application settings (admin-only).
It accepts a map of setting keys and values and sends them through client-go's UpdateSettingsOptions. At client-go v3.30.0 that struct models 447 of the 677 top-level params GitLab 19.5.0's PUT route declares, and encoding/json drops a member the target does not carry without a word, so a patch naming one of the other 230 used to be sent with that key missing, answered 200, and reported to the model as a reconfiguration that never happened. The keys it does not model are therefore named and the whole patch refused before anything is sent: a half-applied patch reported as applied is the one outcome worth refusing for, which is the condition this repository states for preferring a refusal to a decode that fails open.
The same patch is half applied when GitLab drops a key rather than encoding/json, which is what happens to the settings the struct models and the route does not declare ([undeclaredSettingKeys]): client-go sends them, the route hands its handler the params it declares and no others, and the rest of the patch is applied and answered 200. Those keys are refused with the others, in the same refusal.
The answer is read from the captured response for the reason Get is.