Help us shape the future of Go! Take the 2026 Go Developer Survey

resources

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package resources registers read-only MCP resources for GitLab and server metadata.

Resources expose project data, tool manifests, and workflow guides through stable gitlab:// URIs. They are intended for discovery and context loading rather than mutation, and their output is formatted for predictable use by MCP clients and LLMs.

Resource Families

The package registers several groups of resources:

The public tool manifest resources expose these URI shapes:

gitlab://tools
gitlab://tools/{id}

Register wires the GitLab-backed resources into an MCP server.

Narrowing

A GitLab-backed resource is a second request path to data a tool also returns, with the same credential, so the operator's --exclude-tools must reach it: RegisterOptions carries the excluded catalog actions and resourceBackingActions is the table relating the two surfaces. Tool-manifest and workflow-guide resources are static documents about this server and are never narrowed.

The prompt surface, which was the third path to the same data, now takes the same options: github.com/jmrplens/gitlab-mcp-server/v3/internal/prompts.RegisterOptions carries the excluded actions and that package keeps its own prompt-to-action table.

The rate limiter applied where tools are registered meters this surface too: resources/read, resources/subscribe and subscriptions/listen draw on the same bucket as tools/call, as prompts/get does, so none of them is an unmetered proxy to GitLab. A refused request here is a JSON-RPC error carrying the code that mirrors HTTP 429, since a resource result has no error flag of its own. See toolutil.AttachRateLimit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterToolSurfaceResources

func RegisterToolSurfaceResources(server *mcp.Server, opts ToolSurfaceResourceOptions)

RegisterToolSurfaceResources wires a surface-aware tool manifest into the MCP server. Two resources are registered:

  • The static "gitlab://tools" resource, which lists the active surface ("dynamic", "meta", or "individual") and every executable entry that surface exposes.
  • The "gitlab://tools/{id}" template resource, which returns the accepted call shape and input schema for one entry.

Use ToolSurfaceResourceOptions to pass the active tool surface; see [newToolSurfaceSnapshot] for the projection rules.

func RegisterWorkflowGuides

func RegisterWorkflowGuides(server *mcp.Server)

RegisterWorkflowGuides registers static text resources with workflow best-practice content. The package-internal [workflowGuides] table defines the five guides exposed:

gitlab://guides/git-workflow
gitlab://guides/merge-request-hygiene
gitlab://guides/conventional-commits
gitlab://guides/code-review
gitlab://guides/pipeline-troubleshooting

These guides help LLMs provide consistent advice on Git workflows, merge requests, commits, code reviews, and pipeline troubleshooting.

func ToolSurfaceResourceURIs added in v3.1.0

func ToolSurfaceResourceURIs() []string

ToolSurfaceResourceURIs names what RegisterToolSurfaceResources registers: the manifest's static URI and the template of its per-entry detail.

They are the two resources whose content the active tool surface decides. Every other resource is registered from the capability surface and the operator's exclusions alone, and reads the same whichever tool surface and protective mode a session runs, while these two list what the surface registered after the read-only and safe passes. A reader outside this package that has to tell them apart, which the e2e coverage command does to count them at that finer grain, asks here rather than spelling the two strings again, so a rename here reaches it.

Each call returns a slice of its own, so a caller may sort or trim it.

Types

type BoardResourceOutput

type BoardResourceOutput struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

BoardResourceOutput is the JSON payload for a single project issue board, returned by the "gitlab://project/{id}/board/{board_id}" resource. It contains the board's ID and name.

type BranchResourceOutput

type BranchResourceOutput struct {
	Name      string `json:"name"`
	Protected bool   `json:"protected"`
	Merged    bool   `json:"merged"`
	Default   bool   `json:"default"`
	WebURL    string `json:"web_url"`
}

BranchResourceOutput is the JSON payload for a single repository branch (used by both the branch listing and the branch detail resources). It includes the branch's name, protection flag, merge status, default flag, and web URL.

type CommitResourceOutput

type CommitResourceOutput struct {
	ID             string             `json:"id"`
	ShortID        string             `json:"short_id"`
	Title          string             `json:"title"`
	Message        string             `json:"message"`
	AuthorName     string             `json:"author_name"`
	AuthorEmail    string             `json:"author_email"`
	CommitterName  string             `json:"committer_name"`
	CommitterEmail string             `json:"committer_email"`
	AuthoredDate   string             `json:"authored_date,omitempty"`
	CommittedDate  string             `json:"committed_date,omitempty"`
	WebURL         string             `json:"web_url"`
	ParentIDs      []string           `json:"parent_ids,omitempty"`
	Stats          *CommitStatsOutput `json:"stats,omitempty"`
}

CommitResourceOutput is the JSON payload returned by the "gitlab://project/{id}/commit/{sha}" resource. It contains the commit's full ID, short ID, title, full message, author and committer names and emails, authored/committed timestamps, parent commit IDs, web URL, and optional CommitStatsOutput with addition/deletion totals.

The committer is the one the description always named and the handler never published, while GitLab sends it on every commit (issue 1169).

type CommitStatsOutput

type CommitStatsOutput struct {
	Additions int64 `json:"additions"`
	Deletions int64 `json:"deletions"`
	Total     int64 `json:"total"`
}

CommitStatsOutput holds line addition and deletion totals for a single commit, returned as a sub-object of CommitResourceOutput.

type DeployKeyResourceOutput

type DeployKeyResourceOutput struct {
	ID          int64  `json:"id"`
	Title       string `json:"title"`
	Key         string `json:"key"`
	Fingerprint string `json:"fingerprint,omitempty"`
}

DeployKeyResourceOutput is the JSON payload for a single project deploy key, returned by the "gitlab://project/{id}/deploy_key/{deploy_key_id}" resource. It contains the key's ID, title, public key text, and optional SHA256 fingerprint.

type DeploymentResourceOutput

type DeploymentResourceOutput struct {
	ID          int64  `json:"id"`
	IID         int64  `json:"iid"`
	Ref         string `json:"ref"`
	SHA         string `json:"sha"`
	Status      string `json:"status"`
	Environment string `json:"environment,omitempty"`
}

DeploymentResourceOutput is the JSON payload for a single project deployment, returned by the "gitlab://project/{id}/deployment/{deployment_id}" resource. It contains the deployment's ID, IID, ref, SHA, status, and optional environment name.

type EnvironmentResourceOutput

type EnvironmentResourceOutput struct {
	ID    int64  `json:"id"`
	Name  string `json:"name"`
	Slug  string `json:"slug"`
	State string `json:"state"`
	Tier  string `json:"tier,omitempty"`
}

EnvironmentResourceOutput is the JSON payload for a single project environment, returned by the "gitlab://project/{id}/environment/{environment_id}" resource. It contains the environment's ID, name, slug, state, and optional tier ("production", "staging", "testing", "development", or other).

type FeatureFlagResourceOutput

type FeatureFlagResourceOutput struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Active      bool   `json:"active"`
	Version     string `json:"version"`
}

FeatureFlagResourceOutput is the JSON payload for a single project feature flag, returned by the "gitlab://project/{id}/feature_flag/{name}" resource. It contains the flag's name, optional description, active flag, and the strategy version ("legacy" or "new").

type FileBlobResourceOutput

type FileBlobResourceOutput struct {
	FileName        string `json:"file_name"`
	FilePath        string `json:"file_path"`
	Size            int64  `json:"size"`
	Encoding        string `json:"encoding,omitempty"`
	Ref             string `json:"ref"`
	BlobID          string `json:"blob_id"`
	CommitID        string `json:"commit_id"`
	LastCommitID    string `json:"last_commit_id"`
	Content         string `json:"content,omitempty"`
	ContentCategory string `json:"content_category"`
	Truncated       bool   `json:"truncated,omitempty"`
}

FileBlobResourceOutput is the JSON payload returned by the "gitlab://project/{id}/file/{ref}/{path}" resource. Binary content is omitted; only the textual representation is returned (see [decodeFileContent]). Files larger than [fileBlobMaxBytes] are truncated to their metadata with Truncated=true and ContentCategory="truncated".

type GroupResourceOutput

type GroupResourceOutput struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Path        string `json:"path"`
	FullPath    string `json:"full_path"`
	Description string `json:"description"`
	Visibility  string `json:"visibility"`
	WebURL      string `json:"web_url"`
}

GroupResourceOutput is the JSON payload for a GitLab group (used by both the groups listing and the group detail resources). It contains the group's ID, name, path, full path, description, visibility, and web URL.

type HandlerIndex

type HandlerIndex map[string]mcp.ResourceHandler

HandlerIndex maps a resource's URI template — or, for a static resource, its literal URI — to the handler registered for it.

func NewHandlerIndex

func NewHandlerIndex(client *gitlabclient.Client, opts ...RegisterOptions) HandlerIndex

NewHandlerIndex builds the same index Register returns, without registering anything on a server.

This exists to break an ordering problem rather than to duplicate Register: mcp.ServerOptions — which carries the resource-subscription handlers — has to be built before mcp.NewServer returns a server to register onto. Resource handlers only close over the GitLab client, never the server, so the index can be built first and the real registration can happen later against the same client. It takes the same RegisterOptions as Register and must be given the same ones: this index is what a subscription re-reads through, so an excluded resource left in it would still be subscribable and still poll GitLab.

func Register

func Register(server *mcp.Server, client *gitlabclient.Client, opts ...RegisterOptions) HandlerIndex

Register adds every GitLab-backed MCP resource to the given server. The full set of URI shapes exposed by Register is:

gitlab://user/current
gitlab://groups
gitlab://group/{group_id}
gitlab://group/{group_id}/members
gitlab://group/{group_id}/projects
gitlab://group/{group_id}/milestone/{milestone_iid}
gitlab://group/{group_id}/label/{label_id}
gitlab://project/{project_id}
gitlab://project/{project_id}/members
gitlab://project/{project_id}/issues
gitlab://project/{project_id}/issue/{issue_iid}
gitlab://project/{project_id}/pipelines/latest
gitlab://project/{project_id}/pipeline/{pipeline_id}
gitlab://project/{project_id}/pipeline/{pipeline_id}/jobs
gitlab://project/{project_id}/labels
gitlab://project/{project_id}/label/{label_id}
gitlab://project/{project_id}/milestones
gitlab://project/{project_id}/milestone/{milestone_iid}
gitlab://project/{project_id}/mr/{merge_request_iid}
gitlab://project/{project_id}/mr/{merge_request_iid}/notes
gitlab://project/{project_id}/mr/{merge_request_iid}/discussions
gitlab://project/{project_id}/branches
gitlab://project/{project_id}/branch/{branch}
gitlab://project/{project_id}/releases
gitlab://project/{project_id}/release/{tag_name}
gitlab://project/{project_id}/tags
gitlab://project/{project_id}/tag/{tag_name}
gitlab://project/{project_id}/commit/{sha}
gitlab://project/{project_id}/file/{ref}/{+path}
gitlab://project/{project_id}/wiki/{slug}
gitlab://project/{project_id}/deployment/{deployment_id}
gitlab://project/{project_id}/environment/{environment_id}
gitlab://project/{project_id}/job/{job_id}
gitlab://project/{project_id}/snippet/{snippet_id}
gitlab://project/{project_id}/feature_flag/{name}
gitlab://project/{project_id}/deploy_key/{deploy_key_id}
gitlab://project/{project_id}/board/{board_id}
gitlab://snippet/{snippet_id}

Tool-manifest, workflow-guide, and meta/dynamic schema resources are registered separately by their dedicated Register* helpers (see doc.go for the full family breakdown). Register also returns a HandlerIndex keyed by URI template, so a caller can re-read a resource through the same handler the MCP router dispatches to. Callers that only need registration can ignore it. An optional RegisterOptions narrows the surface: a resource whose data an excluded action also served is neither registered on the server nor placed in the returned index, so it cannot be read and cannot be subscribed to either.

func (HandlerIndex) Read

func (index HandlerIndex) Read(ctx context.Context, uriTemplate, uri string) ([]byte, error)

Read invokes the handler registered for uriTemplate and returns the resource's content as the client would receive it.

The SDK keeps its own URI-to-handler lookup unexported, so a server cannot read its own resources; this index is how that gap is closed without duplicating any read logic. Callers resolve uriTemplate from the concrete URI themselves — the subscription whitelist already parses these URIs and knows which template each one belongs to.

type IssueResourceOutput

type IssueResourceOutput struct {
	ID        int64    `json:"id"`
	IID       int64    `json:"iid"`
	Title     string   `json:"title"`
	State     string   `json:"state"`
	Labels    []string `json:"labels"`
	Assignees []string `json:"assignees"`
	Author    string   `json:"author"`
	WebURL    string   `json:"web_url"`
	CreatedAt string   `json:"created_at"`
}

IssueResourceOutput is the JSON payload for a single project issue (used by both the issues listing and the issue detail resources). It contains the issue's ID, IID, title, state, labels, assignees (usernames), author username, web URL, and creation timestamp.

type JobResourceOutput

type JobResourceOutput struct {
	ID            int64   `json:"id"`
	Name          string  `json:"name"`
	Stage         string  `json:"stage"`
	Status        string  `json:"status"`
	Ref           string  `json:"ref"`
	Duration      float64 `json:"duration"`
	FailureReason string  `json:"failure_reason,omitempty"`
	WebURL        string  `json:"web_url"`
}

JobResourceOutput is the JSON payload for a single pipeline job returned by the "gitlab://project/{id}/pipeline/{id}/jobs" and "gitlab://project/{id}/job/{job_id}" resources. It contains the job's ID, name, stage, status, ref, duration in seconds, failure reason (omitted when empty), and web URL.

type LabelResourceOutput

type LabelResourceOutput struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Color       string `json:"color"`
	Description string `json:"description"`
}

LabelResourceOutput is the JSON payload for a single project or group label: its ID, name, color (hex) and optional description.

It carries no usage count, because the single-label routes never send one: lib/api/entities/label.rb exposes the counts only under options[:with_counts], which GitLab sets from the with_counts parameter of the two label listings, and GET /projects/:id/labels/:name and GET /groups/:id/labels/:name declare no such parameter. The label detail resources used to publish open_issues_count and open_merge_requests_count as 0 for every label (issue 1174).

type LabelUsageResourceOutput added in v3.2.0

type LabelUsageResourceOutput struct {
	LabelResourceOutput
	OpenIssuesCount        int64 `json:"open_issues_count"`
	OpenMergeRequestsCount int64 `json:"open_merge_requests_count"`
}

LabelUsageResourceOutput is one row of the project labels resource: the label and the counts of open issues and open merge requests using it, which GitLab sends because that listing asks with_counts=true.

type MRDiscussionNoteResourceOutput

type MRDiscussionNoteResourceOutput struct {
	ID         int64  `json:"id"`
	Author     string `json:"author"`
	Body       string `json:"body"`
	System     bool   `json:"system"`
	Resolved   bool   `json:"resolved"`
	Resolvable bool   `json:"resolvable"`
	CreatedAt  string `json:"created_at,omitempty"`
}

MRDiscussionNoteResourceOutput is the JSON payload for a single note inside a discussion thread, returned as part of the "gitlab://project/{id}/mr/{iid}/discussions" resource. It contains the note's ID, author username, body, system flag, resolved and resolvable flags, and optional creation timestamp.

type MRDiscussionResourceOutput

type MRDiscussionResourceOutput struct {
	ID             string                           `json:"id"`
	IndividualNote bool                             `json:"individual_note"`
	Notes          []MRDiscussionNoteResourceOutput `json:"notes"`
}

MRDiscussionResourceOutput is the JSON payload for a single discussion thread on a merge request. It bundles a thread ID, the individual_note flag (true for non-threaded comments), and the ordered list of notes that make up the thread.

type MRNoteResourceOutput

type MRNoteResourceOutput struct {
	ID         int64  `json:"id"`
	Author     string `json:"author"`
	Body       string `json:"body"`
	System     bool   `json:"system"`
	Resolvable bool   `json:"resolvable,omitempty"`
	Resolved   bool   `json:"resolved,omitempty"`
	CreatedAt  string `json:"created_at,omitempty"`
	UpdatedAt  string `json:"updated_at,omitempty"`
}

MRNoteResourceOutput is the JSON payload for a single merge-request note inside the flat "gitlab://project/{id}/mr/{iid}/notes" list resource. It contains the note's ID, author username, body, system flag, resolvable and resolved flags (omitted when not resolvable), and optional creation and update timestamps.

type MRResourceOutput

type MRResourceOutput struct {
	ID           int64  `json:"id"`
	IID          int64  `json:"iid"`
	Title        string `json:"title"`
	State        string `json:"state"`
	SourceBranch string `json:"source_branch"`
	TargetBranch string `json:"target_branch"`
	Author       string `json:"author"`
	WebURL       string `json:"web_url"`
	MergeStatus  string `json:"merge_status"`
}

MRResourceOutput is the JSON payload returned by the "gitlab://project/{id}/mr/{iid}" resource. It contains the MR's ID, IID, title, state, source and target branches, author username, web URL, and detailed merge status.

type MemberResourceOutput

type MemberResourceOutput struct {
	ID          int64  `json:"id"`
	Username    string `json:"username"`
	Name        string `json:"name"`
	State       string `json:"state"`
	AccessLevel int    `json:"access_level"`
	WebURL      string `json:"web_url"`
}

MemberResourceOutput is the JSON payload for a single member entry in the "gitlab://{project|group}/{id}/members" resources. It includes the member's ID, username, display name, account state, numeric access level (10=guest, 20=reporter, 30=developer, 40=maintainer, 50=owner), and web URL.

type MilestoneResourceOutput

type MilestoneResourceOutput struct {
	ID          int64  `json:"id"`
	IID         int64  `json:"iid"`
	Title       string `json:"title"`
	Description string `json:"description"`
	State       string `json:"state"`
	DueDate     string `json:"due_date,omitempty"`
	WebURL      string `json:"web_url"`
}

MilestoneResourceOutput is the JSON payload for a single project or group milestone. It includes the milestone's ID, IID, title, description, state (active/closed), optional due date, and web URL.

type PipelineResourceOutput

type PipelineResourceOutput struct {
	ID     int64  `json:"id"`
	IID    int64  `json:"iid"`
	Status string `json:"status"`
	Ref    string `json:"ref"`
	SHA    string `json:"sha"`
	WebURL string `json:"web_url"`
	Source string `json:"source"`
}

PipelineResourceOutput is the JSON payload returned by the pipeline detail resources ("gitlab://project/{id}/pipelines/latest" and "gitlab://project/{id}/pipeline/{pipeline_id}"). It contains the pipeline's ID, IID, status, ref, SHA, web URL, and source ("push", "web", etc.).

type ProjectResourceOutput

type ProjectResourceOutput struct {
	ID                int64  `json:"id"`
	Name              string `json:"name"`
	PathWithNamespace string `json:"path_with_namespace"`
	Visibility        string `json:"visibility"`
	WebURL            string `json:"web_url"`
	Description       string `json:"description"`
	DefaultBranch     string `json:"default_branch"`
}

ProjectResourceOutput is the JSON payload returned by the "gitlab://project/{project_id}" resource. It contains the project's identifying fields, namespace path, visibility, web URL, description, and default branch — enough for clients to render a project card without an extra API call.

type RegisterOptions

type RegisterOptions struct {
	// ExcludedActions holds canonical catalog action IDs ("project.get") the
	// operator removed on the active surface.
	//
	// Canonical IDs rather than tool names on purpose: --exclude-tools accepts
	// a group name, an individual tool name or an action ID, and only the
	// action catalog can resolve those three spellings to the same action. The
	// caller resolves them once against the catalog it just filtered, so this
	// package needs one table keyed by one kind of name.
	ExcludedActions []string
}

RegisterOptions narrows the resource surface the way --exclude-tools narrows the tool surface.

The two surfaces are one request path each to the same GitLab data with the same credential, and until this existed only the tool one could be narrowed: an operator who excluded gitlab_project_get was still served the identical project object at gitlab://project/{id}. That mattered most where exclusion is the recommended mitigation for a tool, because the mitigation covered half the ways to reach it.

Prompts are the other half of the same gap and are not covered here; see the package documentation.

type ReleaseResourceOutput

type ReleaseResourceOutput struct {
	TagName     string `json:"tag_name"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Author      string `json:"author"`
	CreatedAt   string `json:"created_at,omitempty"`
	ReleasedAt  string `json:"released_at,omitempty"`
}

ReleaseResourceOutput is the JSON payload for a single project release (used by both the releases listing and the release detail resources). It contains the tag name, release name, description, author username, creation timestamp, and optional release timestamp.

type SnippetResourceOutput

type SnippetResourceOutput struct {
	ID          int64  `json:"id"`
	Title       string `json:"title"`
	FileName    string `json:"file_name"`
	Description string `json:"description"`
	Visibility  string `json:"visibility"`
	WebURL      string `json:"web_url"`
}

SnippetResourceOutput is the JSON payload for a personal (global) or project snippet, returned by the "gitlab://snippet/{snippet_id}" and "gitlab://project/{id}/snippet/{snippet_id}" resources. It contains the snippet's ID, title, file name, description, visibility, and web URL.

type TagResourceOutput

type TagResourceOutput struct {
	Name      string `json:"name"`
	Message   string `json:"message,omitempty"`
	Target    string `json:"target"`
	Protected bool   `json:"protected"`
	CreatedAt string `json:"created_at,omitempty"`
}

TagResourceOutput is the JSON payload for a single repository tag (used by both the tags listing and the tag detail resources). It contains the tag name, optional annotation message, target commit SHA, protection status, and optional creation timestamp.

type ToolSurfaceCallShape

type ToolSurfaceCallShape struct {
	Tool            string `json:"tool"`
	Action          string `json:"action,omitempty"`
	ActionLocation  string `json:"action_location,omitempty"`
	ParamsLocation  string `json:"params_location"`
	ConfirmLocation string `json:"confirm_location,omitempty"`
}

ToolSurfaceCallShape describes how to invoke one manifest entry. ActionLocation and ConfirmLocation are populated only for surfaces where those fields apply (dynamic, meta); they are empty in individual mode.

type ToolSurfaceDetail

type ToolSurfaceDetail struct {
	ToolSurfaceEntry
	Call        ToolSurfaceCallShape `json:"call"`
	InputSchema any                  `json:"input_schema,omitempty"`
	// FineGrained is what a fine-grained personal access token needs for the
	// action at the GitLab release the table was recorded at, in GitLab's
	// words, or why none can run it. It is served for every session, classic
	// tokens included, since the detail is where a model looks up what an
	// action needs; the listing and find results do not carry it.
	FineGrained *finegrained.Description `json:"fine_grained,omitempty"`
	// Withheld says why this session may not run the action, when it is a
	// fine-grained session the action is withheld from, or, on a meta tool's
	// own detail, why it may run none of the tool's actions; absent otherwise.
	// The detail is served rather than answered not found, because the detail
	// is where a model looks up why it cannot find an action in the listing.
	Withheld *ToolSurfaceWithheld `json:"withheld,omitempty"`
}

ToolSurfaceDetail is the JSON payload returned by the "gitlab://tools/{id}" resource. It embeds the matching ToolSurfaceEntry and adds the per-entry call shape and input schema.

type ToolSurfaceEntry

type ToolSurfaceEntry struct {
	ID            string `json:"id"`
	Kind          string `json:"kind"`
	Tool          string `json:"tool"`
	Action        string `json:"action,omitempty"`
	Domain        string `json:"domain,omitempty"`
	BackingTool   string `json:"backing_tool,omitempty"`
	BackingAction string `json:"backing_action,omitempty"`
	Title         string `json:"title,omitempty"`
	Description   string `json:"description,omitempty"`
	// AliasOf names the primary entry when this action is a deliberate
	// alias: a second canonical ID projected from the same route and the
	// same individual tool, kept for discovery (user.me for user.current,
	// repository.file_history for repository.commit_list). Clients that
	// dedupe should keep the primary and treat this entry as a pointer.
	AliasOf        string                     `json:"alias_of,omitempty"`
	DetailURI      string                     `json:"detail_uri"`
	Destructive    bool                       `json:"destructive"`
	ReadOnly       bool                       `json:"read_only"`
	RequiredParams []ToolSurfaceRequiredParam `json:"required_params,omitempty"`
	// RequiredParamsAnyOf lists alternative requirement groups: the schema
	// accepts a call satisfying at least one group ("name, description or
	// color", "file_name+content or files"). These names are NOT in
	// RequiredParams — publishing an alternative as unconditionally
	// required invites clients to send every branch at once.
	RequiredParamsAnyOf [][]ToolSurfaceRequiredParam `json:"required_params_any_of,omitempty"`
}

ToolSurfaceEntry describes one executable unit in the active tool surface. Entries can be dynamic actions (gitlab_execute_action surface), meta actions (gitlab_<tool>.<action> surface), or individual tools (one MCP tool per GitLab action).

type ToolSurfaceManifest

type ToolSurfaceManifest struct {
	Surface          string `json:"surface"`
	URITemplate      string `json:"uri_template"`
	VisibleToolCount int    `json:"visible_tool_count"`
	EntryCount       int    `json:"entry_count"`
	// Subscriptions describes the resources/subscribe support this server
	// offers, or is omitted when it offers none. It lives in the manifest —
	// the one resource kept even on the minimal capability surface — so a
	// machine consumer has a single place to learn the watchable set.
	Subscriptions *ToolSurfaceSubscriptions `json:"subscriptions,omitempty"`
	VisibleTools  []ToolSurfaceVisibleTool  `json:"visible_tools"`
	Entries       []ToolSurfaceEntry        `json:"entries"`
}

ToolSurfaceManifest is the JSON payload returned by the "gitlab://tools" resource. It summarizes the active tool surface and lists every executable entry the surface exposes.

type ToolSurfaceRequiredParam

type ToolSurfaceRequiredParam struct {
	Name string `json:"name"`
	Type string `json:"type,omitempty"`
}

ToolSurfaceRequiredParam names one required parameter of a manifest entry together with its flat JSON-Schema type ("integer", "string", "boolean", "array", …; a multi-typed parameter joins them as "integer|string"). Only the name and the plain type live here — a static consumer of the aggregate manifest should not need 851 detail reads to label a parameter — while descriptions, enums, and optional parameters stay in the per-entry input schema at gitlab://tools/{id}.

An absent type is deliberate, not an omission bug: the schema states no single plain type for that parameter (admin.feature_set's value accepts boolean, string, or integer). Consumers should read it as "any" and consult the entry's input schema for the full shape.

type ToolSurfaceResourceOptions

type ToolSurfaceResourceOptions struct {
	Surface    string
	Tools      []*mcp.Tool
	Catalog    *actioncatalog.Catalog
	MetaRoutes map[string]toolutil.ActionMap
	// SubscribableURITemplates lists the resource URI templates that accept
	// resources/subscribe on this server. Empty means subscriptions are not
	// offered (CAPABILITY_SURFACE=minimal), and the manifest then omits the
	// section rather than advertising a capability the server would refuse.
	SubscribableURITemplates []string
	// ShareKey, when set, names the configuration the manifest describes,
	// and the snapshot built for it is cached for the process and served by
	// every server registered under the same key. The caller must include
	// in it everything the manifest depends on other than the credential:
	// the surface, the shared catalog's identity, the narrowing that
	// decides which tools are visible, the meta parameter-schema mode and
	// the capability surface. Empty builds a private snapshot.
	ShareKey string
	// StandaloneActions maps each standalone utility's registered tool name
	// to its canonical action ID. The meta and individual surfaces register
	// those tools beside the catalog rather than in it, so this is how their
	// details find the fine-grained requirement the catalog's actions carry.
	// Nil leaves them without the block.
	StandaloneActions map[string]string
	// ToolActions maps each registered tool to the canonical IDs of the
	// actions it runs: one for an individual or standalone tool, every action
	// of its group for a meta tool, none for the dynamic surface's two tools.
	// It is what a fine-grained session's read of the manifest is narrowed by
	// (issue 952), and it is the server's own answer, the same one its
	// tools/list filter reads, so the two can never list different tools.
	// Nil narrows only the entries whose action the catalog names.
	ToolActions map[string][]string
}

ToolSurfaceResourceOptions captures the active server tool surface for the unified tool manifest resources (RegisterToolSurfaceResources). All three slices are projected differently depending on the surface (see [newToolSurfaceSnapshot]).

type ToolSurfaceSubscriptions

type ToolSurfaceSubscriptions struct {
	Supported bool `json:"supported"`
	// SubscribableURITemplates are the single-object resource URI templates
	// a subscription is accepted for; anything else is refused. Sourced
	// from the enforcement whitelist itself, never copied.
	SubscribableURITemplates []string `json:"subscribable_uri_templates"`
	Notification             string   `json:"notification"`
}

ToolSurfaceSubscriptions advertises resources/subscribe support in the gitlab://tools manifest.

type ToolSurfaceVisibleTool

type ToolSurfaceVisibleTool struct {
	Name        string `json:"name"`
	Title       string `json:"title,omitempty"`
	DetailURI   string `json:"detail_uri"`
	ReadOnly    bool   `json:"read_only"`
	Destructive bool   `json:"destructive"`
}

ToolSurfaceVisibleTool summarizes one MCP tool currently advertised through tools/list, surfaced in the ToolSurfaceManifest's VisibleTools list.

type ToolSurfaceWithheld added in v3.2.0

type ToolSurfaceWithheld struct {
	Cause   string                      `json:"cause,omitempty"`
	Message string                      `json:"message,omitempty"`
	Actions []ToolSurfaceWithheldAction `json:"actions,omitempty"`
}

ToolSurfaceWithheld is what the detail of an action a fine-grained session may not run carries in place of being absent: why, in the words a call to it is refused with.

The detail of a tool that runs several actions, a meta tool, carries it when the session may run none of them, which is when tools/list leaves the tool out: Actions then says why for each, in the same words, and Cause and Message are empty, since the actions of one group need not share a reason.

type ToolSurfaceWithheldAction added in v3.2.0

type ToolSurfaceWithheldAction struct {
	ID      string `json:"id"`
	Cause   string `json:"cause"`
	Message string `json:"message"`
}

ToolSurfaceWithheldAction is why one action of a withheld meta tool is withheld, keyed by its canonical ID.

type UserResourceOutput

type UserResourceOutput struct {
	ID       int64  `json:"id"`
	Username string `json:"username"`
	Name     string `json:"name"`
	Email    string `json:"email"`
	State    string `json:"state"`
	WebURL   string `json:"web_url"`
	IsAdmin  bool   `json:"is_admin"`
}

UserResourceOutput is the JSON payload returned by the "gitlab://user/current" resource. It contains the authenticated user's profile fields: ID, username, display name, email, account state, web URL, and admin status.

type WikiResourceOutput

type WikiResourceOutput struct {
	Title    string `json:"title"`
	Slug     string `json:"slug"`
	Format   string `json:"format"`
	Content  string `json:"content,omitempty"`
	Encoding string `json:"encoding,omitempty"`
}

WikiResourceOutput is the JSON payload returned by the "gitlab://project/{id}/wiki/{slug}" resource. It contains the page title, slug, format (markdown, rdoc, asciidoc, or org), raw content, and encoding (omitted when the API does not return one).

Jump to

Keyboard shortcuts

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