resources

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

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

Resources expose project data, tool manifests, workflow guides, and MCP workspace roots 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

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

Register registers all MCP resources (read-only data endpoints).

func RegisterDynamicSchemaResources added in v2.0.3

func RegisterDynamicSchemaResources(server *mcp.Server, catalog *actioncatalog.Catalog)

RegisterDynamicSchemaResources wires dynamic action catalog resources into the MCP server. The index uses canonical domain.action IDs accepted by gitlab_execute_tool, while the template returns action-specific params schemas without adding meta-tool-only params such as confirm.

func RegisterMetaSchemaResources

func RegisterMetaSchemaResources(server *mcp.Server, routes map[string]toolutil.ActionMap)

RegisterMetaSchemaResources wires the index resource and the per-action template resource into the MCP server. Both are read-only and do not need a GitLab client; callers pass the exact meta-tool routes that are visible on this server after configuration filters have been applied.

func RegisterToolSurfaceResources added in v2.0.3

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

RegisterToolSurfaceResources wires a surface-aware tool manifest into the MCP server. The static resource lists the active surface and executable entries, while the template returns the accepted call shape for one entry.

func RegisterWorkflowGuides

func RegisterWorkflowGuides(server *mcp.Server)

RegisterWorkflowGuides registers static text resources with workflow best-practice content. These guides help LLMs provide consistent advice on git workflows, merge requests, commits, code reviews, and pipeline troubleshooting.

func RegisterWorkspaceRoots

func RegisterWorkspaceRoots(server *mcp.Server, rootsMgr *roots.Manager)

RegisterWorkspaceRoots registers the "gitlab://workspace/roots" resource. It exposes the client workspace root URIs so LLMs can read .git/config and use gitlab_discover_project to discover the project.

Types

type BoardResourceOutput

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

BoardResourceOutput is the output for a single project issue board.

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 output for a repository branch.

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"`
	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 output for a single commit resource.

type CommitStatsOutput

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

CommitStatsOutput holds additions/deletions/total for a commit resource.

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 output for a single project deploy key.

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 output for a single project deployment.

type DynamicSchemaActionEntry added in v2.0.3

type DynamicSchemaActionEntry struct {
	ID             string   `json:"id"`
	Tool           string   `json:"tool"`
	Domain         string   `json:"domain"`
	Action         string   `json:"action"`
	SchemaURI      string   `json:"schema_uri"`
	MetaSchemaURI  string   `json:"meta_schema_uri,omitempty"`
	Destructive    bool     `json:"destructive"`
	RequiredParams []string `json:"required_params,omitempty"`
}

DynamicSchemaActionEntry describes one executable dynamic catalog action.

type DynamicSchemaIndex added in v2.0.3

type DynamicSchemaIndex struct {
	URITemplate string                     `json:"uri_template"`
	ExecuteTool string                     `json:"execute_tool"`
	ActionCount int                        `json:"action_count"`
	Actions     []DynamicSchemaActionEntry `json:"actions"`
}

DynamicSchemaIndex is the payload returned by the dynamic index resource.

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 output for a single project environment.

type FeatureFlagResourceOutput

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

FeatureFlagResourceOutput is the output for a single project feature flag.

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 output for a repository file blob resource. Binary content is omitted; only the textual representation is returned.

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 output for a GitLab group.

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 output for a project issue.

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 output for a pipeline job.

type LabelResourceOutput

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

LabelResourceOutput is the output for a project label.

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 output for a note inside a discussion thread of the MR discussions resource.

type MRDiscussionResourceOutput

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

MRDiscussionResourceOutput is the output for a single discussion 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 output for a single merge-request note inside the MR notes resource.

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 output for a merge request resource.

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 output for a project member.

type MetaSchemaIndex

type MetaSchemaIndex struct {
	URITemplate string                 `json:"uri_template"`
	Tools       []MetaSchemaIndexEntry `json:"tools"`
}

MetaSchemaIndex is the payload returned by the index resource.

type MetaSchemaIndexEntry

type MetaSchemaIndexEntry struct {
	Tool    string   `json:"tool"`
	Actions []string `json:"actions"`
}

MetaSchemaIndexEntry is a single tool entry in the index resource payload.

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 output for a project milestone.

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 output for a pipeline.

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 output for the project resource.

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"`
	ReleasedAt  string `json:"released_at,omitempty"`
}

ReleaseResourceOutput is the output for a project release.

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 output for a personal or project snippet.

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 output for a repository tag.

type ToolSurfaceCallShape added in v2.0.3

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 detail entry.

type ToolSurfaceDetail added in v2.0.3

type ToolSurfaceDetail struct {
	ToolSurfaceEntry
	Call        ToolSurfaceCallShape `json:"call"`
	InputSchema any                  `json:"input_schema,omitempty"`
}

ToolSurfaceDetail is the payload returned by gitlab://tools/{id}.

type ToolSurfaceEntry added in v2.0.3

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"`
	DetailURI      string   `json:"detail_uri"`
	Destructive    bool     `json:"destructive"`
	ReadOnly       bool     `json:"read_only"`
	RequiredParams []string `json:"required_params,omitempty"`
}

ToolSurfaceEntry describes one executable unit in the active surface.

type ToolSurfaceManifest added in v2.0.3

type ToolSurfaceManifest struct {
	Surface          string                   `json:"surface"`
	URITemplate      string                   `json:"uri_template"`
	VisibleToolCount int                      `json:"visible_tool_count"`
	EntryCount       int                      `json:"entry_count"`
	VisibleTools     []ToolSurfaceVisibleTool `json:"visible_tools"`
	Entries          []ToolSurfaceEntry       `json:"entries"`
}

ToolSurfaceManifest is the payload returned by gitlab://tools.

type ToolSurfaceResourceOptions added in v2.0.3

type ToolSurfaceResourceOptions struct {
	Surface    string
	Tools      []*mcp.Tool
	Catalog    *actioncatalog.Catalog
	MetaRoutes map[string]toolutil.ActionMap
}

ToolSurfaceResourceOptions captures the active server tool surface for the unified tool manifest resources.

type ToolSurfaceVisibleTool added in v2.0.3

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.

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 output for the current user resource.

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 output for a wiki page resource.

type WorkspaceRootOutput

type WorkspaceRootOutput struct {
	URI  string `json:"uri"`
	Name string `json:"name,omitempty"`
}

WorkspaceRootOutput describes a single workspace root provided by the MCP client.

type WorkspaceRootsOutput

type WorkspaceRootsOutput struct {
	Roots []WorkspaceRootOutput `json:"roots"`
	Hint  string                `json:"hint"`
}

WorkspaceRootsOutput holds the list of workspace roots and a hint for project discovery.

Jump to

Keyboard shortcuts

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