Documentation
¶
Overview ¶
Package samplingtools provides MCP tools that leverage the sampling capability to analyze GitLab data through LLM-assisted summarization and review.
Index ¶
- func FormatAnalyzeCIConfigMarkdown(a AnalyzeCIConfigOutput) string
- func FormatAnalyzeDeploymentHistoryMarkdown(a AnalyzeDeploymentHistoryOutput) string
- func FormatAnalyzeIssueScopeMarkdown(a AnalyzeIssueScopeOutput) string
- func FormatAnalyzeMRChangesMarkdown(a AnalyzeMRChangesOutput) string
- func FormatAnalyzePipelineFailureMarkdown(a AnalyzePipelineFailureOutput) string
- func FormatCIConfigForAnalysis(lint cilint.Output) string
- func FormatDeploymentHistoryForAnalysis(depList deployments.ListOutput, environment string) string
- func FormatFindTechnicalDebtMarkdown(f FindTechnicalDebtOutput) string
- func FormatGenerateMilestoneReportMarkdown(r GenerateMilestoneReportOutput) string
- func FormatGenerateReleaseNotesMarkdown(r GenerateReleaseNotesOutput) string
- func FormatIssueForSummary(issue issues.Output, notes issuenotes.ListOutput) string
- func FormatIssueScopeForAnalysis(issue issues.Output, timeStats issues.TimeStatsOutput, ...) string
- func FormatMRForAnalysis(mr mergerequests.Output, changes mrchanges.Output) string
- func FormatMRReviewForAnalysis(mr mergerequests.Output, discussions mrdiscussions.ListOutput, ...) string
- func FormatMilestoneForAnalysis(ms milestones.Output, msIssues milestones.MilestoneIssuesOutput, ...) string
- func FormatPipelineFailureForAnalysis(pipeline pipelines.DetailOutput, traces []JobTrace) string
- func FormatReleaseDataForAnalysis(from, to string, cmp repository.CompareOutput, mrs mergerequests.ListOutput) string
- func FormatReviewMRSecurityMarkdown(r ReviewMRSecurityOutput) string
- func FormatSummarizeIssueMarkdown(s SummarizeIssueOutput) string
- func FormatSummarizeMRReviewMarkdown(s SummarizeMRReviewOutput) string
- func FormatTechnicalDebtForAnalysis(blobs []search.BlobOutput) string
- func RegisterMeta(server *mcp.Server, client *gitlabclient.Client)
- func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
- func SamplingUnsupportedResult(toolName string) *mcp.CallToolResult
- type AnalyzeCIConfigInput
- type AnalyzeCIConfigOutput
- type AnalyzeDeploymentHistoryInput
- type AnalyzeDeploymentHistoryOutput
- type AnalyzeIssueScopeInput
- type AnalyzeIssueScopeOutput
- type AnalyzeMRChangesInput
- type AnalyzeMRChangesOutput
- type AnalyzePipelineFailureInput
- type AnalyzePipelineFailureOutput
- type FindTechnicalDebtInput
- type FindTechnicalDebtOutput
- type GenerateMilestoneReportInput
- type GenerateMilestoneReportOutput
- type GenerateReleaseNotesInput
- type GenerateReleaseNotesOutput
- type IssueContextResult
- type JobTrace
- type MRContextResult
- type PipelineContextResult
- type ReviewMRSecurityInput
- type ReviewMRSecurityOutput
- type SummarizeIssueInput
- type SummarizeIssueOutput
- type SummarizeMRReviewInput
- type SummarizeMRReviewOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAnalyzeCIConfigMarkdown ¶
func FormatAnalyzeCIConfigMarkdown(a AnalyzeCIConfigOutput) string
FormatAnalyzeCIConfigMarkdown renders an LLM-generated CI config analysis.
func FormatAnalyzeDeploymentHistoryMarkdown ¶
func FormatAnalyzeDeploymentHistoryMarkdown(a AnalyzeDeploymentHistoryOutput) string
FormatAnalyzeDeploymentHistoryMarkdown renders an LLM-generated deployment analysis.
func FormatAnalyzeIssueScopeMarkdown ¶
func FormatAnalyzeIssueScopeMarkdown(a AnalyzeIssueScopeOutput) string
FormatAnalyzeIssueScopeMarkdown renders an LLM-generated issue scope analysis.
func FormatAnalyzeMRChangesMarkdown ¶
func FormatAnalyzeMRChangesMarkdown(a AnalyzeMRChangesOutput) string
FormatAnalyzeMRChangesMarkdown renders an LLM-generated MR analysis.
func FormatAnalyzePipelineFailureMarkdown ¶
func FormatAnalyzePipelineFailureMarkdown(a AnalyzePipelineFailureOutput) string
FormatAnalyzePipelineFailureMarkdown renders an LLM-generated pipeline failure analysis.
func FormatCIConfigForAnalysis ¶
FormatCIConfigForAnalysis builds a Markdown document from CI lint results for LLM configuration analysis.
func FormatDeploymentHistoryForAnalysis ¶
func FormatDeploymentHistoryForAnalysis(depList deployments.ListOutput, environment string) string
FormatDeploymentHistoryForAnalysis builds a Markdown document from deployment records for LLM deployment pattern analysis.
func FormatFindTechnicalDebtMarkdown ¶
func FormatFindTechnicalDebtMarkdown(f FindTechnicalDebtOutput) string
FormatFindTechnicalDebtMarkdown renders an LLM-generated technical debt analysis.
func FormatGenerateMilestoneReportMarkdown ¶
func FormatGenerateMilestoneReportMarkdown(r GenerateMilestoneReportOutput) string
FormatGenerateMilestoneReportMarkdown renders an LLM-generated milestone report.
func FormatGenerateReleaseNotesMarkdown ¶
func FormatGenerateReleaseNotesMarkdown(r GenerateReleaseNotesOutput) string
FormatGenerateReleaseNotesMarkdown renders LLM-generated release notes.
func FormatIssueForSummary ¶
func FormatIssueForSummary(issue issues.Output, notes issuenotes.ListOutput) string
FormatIssueForSummary builds a Markdown document from an issue and its notes, suitable for passing to an LLM for discussion summarization.
func FormatIssueScopeForAnalysis ¶
func FormatIssueScopeForAnalysis(issue issues.Output, timeStats issues.TimeStatsOutput, participants issues.ParticipantsOutput, closingMRs, relatedMRs issues.RelatedMRsOutput, notes issuenotes.ListOutput) string
FormatIssueScopeForAnalysis builds a Markdown document from issue details, time stats, participants, related MRs, and notes for scope analysis.
func FormatMRForAnalysis ¶
func FormatMRForAnalysis(mr mergerequests.Output, changes mrchanges.Output) string
FormatMRForAnalysis builds a Markdown document from a merge request and its file diffs, suitable for passing to an LLM for code review analysis. Also used by ReviewMRSecurity for security-focused reviews.
func FormatMRReviewForAnalysis ¶
func FormatMRReviewForAnalysis(mr mergerequests.Output, discussions mrdiscussions.ListOutput, approvals mrapprovals.StateOutput) string
FormatMRReviewForAnalysis builds a Markdown document from an MR, its discussions, and approval state for LLM review summarization.
func FormatMilestoneForAnalysis ¶
func FormatMilestoneForAnalysis(ms milestones.Output, msIssues milestones.MilestoneIssuesOutput, msMRs milestones.MilestoneMergeRequestsOutput) string
FormatMilestoneForAnalysis builds a Markdown document from a milestone, its issues, and merge requests for LLM report generation.
func FormatPipelineFailureForAnalysis ¶
func FormatPipelineFailureForAnalysis(pipeline pipelines.DetailOutput, traces []JobTrace) string
FormatPipelineFailureForAnalysis builds a Markdown document from pipeline details and failed job traces for LLM failure analysis.
func FormatReleaseDataForAnalysis ¶
func FormatReleaseDataForAnalysis(from, to string, cmp repository.CompareOutput, mrs mergerequests.ListOutput) string
FormatReleaseDataForAnalysis builds a Markdown document combining commits, merged MRs, and file diffs, suitable for LLM release notes generation.
func FormatReviewMRSecurityMarkdown ¶
func FormatReviewMRSecurityMarkdown(r ReviewMRSecurityOutput) string
FormatReviewMRSecurityMarkdown renders an LLM-generated MR security review.
func FormatSummarizeIssueMarkdown ¶
func FormatSummarizeIssueMarkdown(s SummarizeIssueOutput) string
FormatSummarizeIssueMarkdown renders an LLM-generated issue summary.
func FormatSummarizeMRReviewMarkdown ¶
func FormatSummarizeMRReviewMarkdown(s SummarizeMRReviewOutput) string
FormatSummarizeMRReviewMarkdown renders an LLM-generated MR review summary.
func FormatTechnicalDebtForAnalysis ¶
func FormatTechnicalDebtForAnalysis(blobs []search.BlobOutput) string
FormatTechnicalDebtForAnalysis builds a Markdown document from code search results containing debt markers for LLM analysis.
func RegisterMeta ¶ added in v1.0.4
func RegisterMeta(server *mcp.Server, client *gitlabclient.Client)
RegisterMeta registers a single gitlab_analyze meta-tool that consolidates all 11 sampling analysis tools under one action-dispatched interface.
func RegisterTools ¶
func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
RegisterTools wires sampling-powered tools to the MCP server.
func SamplingUnsupportedResult ¶
func SamplingUnsupportedResult(toolName string) *mcp.CallToolResult
SamplingUnsupportedResult returns a structured error tool result when the MCP client does not support sampling. Suggests alternative non-sampling tools.
Types ¶
type AnalyzeCIConfigInput ¶
type AnalyzeCIConfigInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
ContentRef string `json:"content_ref" jsonschema:"Branch or tag for CI content (defaults to default branch)"`
}
AnalyzeCIConfigInput defines parameters for LLM-assisted CI configuration analysis.
type AnalyzeCIConfigOutput ¶
type AnalyzeCIConfigOutput struct {
toolutil.HintableOutput
ProjectID string `json:"project_id"`
Valid bool `json:"valid"`
Analysis string `json:"analysis"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
AnalyzeCIConfigOutput holds the LLM analysis of a CI configuration.
func AnalyzeCIConfig ¶
func AnalyzeCIConfig(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input AnalyzeCIConfigInput) (AnalyzeCIConfigOutput, error)
AnalyzeCIConfig lints a project's CI configuration and delegates to the MCP sampling capability for LLM-assisted analysis of the configuration quality.
type AnalyzeDeploymentHistoryInput ¶
type AnalyzeDeploymentHistoryInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Environment string `json:"environment,omitempty" jsonschema:"Filter by environment name (e.g. production, staging)"`
}
AnalyzeDeploymentHistoryInput defines parameters for LLM-assisted deployment analysis.
type AnalyzeDeploymentHistoryOutput ¶
type AnalyzeDeploymentHistoryOutput struct {
toolutil.HintableOutput
ProjectID string `json:"project_id"`
Environment string `json:"environment,omitempty"`
Analysis string `json:"analysis"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
AnalyzeDeploymentHistoryOutput holds the LLM analysis of deployment history.
func AnalyzeDeploymentHistory ¶
func AnalyzeDeploymentHistory(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input AnalyzeDeploymentHistoryInput) (AnalyzeDeploymentHistoryOutput, error)
AnalyzeDeploymentHistory fetches recent deployments, then delegates to the MCP sampling capability for deployment pattern analysis.
type AnalyzeIssueScopeInput ¶
type AnalyzeIssueScopeInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
IssueIID int64 `json:"issue_iid" jsonschema:"Issue internal ID,required"`
}
AnalyzeIssueScopeInput defines parameters for LLM-assisted issue scope analysis.
type AnalyzeIssueScopeOutput ¶
type AnalyzeIssueScopeOutput struct {
toolutil.HintableOutput
IssueIID int64 `json:"issue_iid"`
Title string `json:"title"`
Analysis string `json:"analysis"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
AnalyzeIssueScopeOutput holds the LLM analysis of an issue's scope and effort.
func AnalyzeIssueScope ¶
func AnalyzeIssueScope(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input AnalyzeIssueScopeInput) (AnalyzeIssueScopeOutput, error)
AnalyzeIssueScope fetches an issue with its time stats, participants, related MRs, and notes, then delegates to the MCP sampling capability for scope analysis.
type AnalyzeMRChangesInput ¶
type AnalyzeMRChangesInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path"`
MRIID int64 `json:"mr_iid" jsonschema:"Merge request internal ID"`
}
AnalyzeMRChangesInput defines parameters for LLM-assisted MR code review.
type AnalyzeMRChangesOutput ¶
type AnalyzeMRChangesOutput struct {
toolutil.HintableOutput
MRIID int64 `json:"mr_iid"`
Title string `json:"title"`
Analysis string `json:"analysis"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
AnalyzeMRChangesOutput holds the LLM analysis result for an MR.
func AnalyzeMRChanges ¶
func AnalyzeMRChanges(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input AnalyzeMRChangesInput) (AnalyzeMRChangesOutput, error)
AnalyzeMRChanges fetches a merge request and its diffs, then delegates to the MCP client's sampling capability for LLM-assisted code review analysis. Returns sampling.ErrSamplingNotSupported if the client lacks sampling support.
type AnalyzePipelineFailureInput ¶
type AnalyzePipelineFailureInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
PipelineID int64 `json:"pipeline_id" jsonschema:"Pipeline ID to analyze,required"`
}
AnalyzePipelineFailureInput defines parameters for the analyze pipeline failure operation.
type AnalyzePipelineFailureOutput ¶
type AnalyzePipelineFailureOutput struct {
toolutil.HintableOutput
PipelineID int64 `json:"pipeline_id"`
Status string `json:"status"`
Ref string `json:"ref"`
Analysis string `json:"analysis"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
AnalyzePipelineFailureOutput holds the LLM analysis of a failed pipeline.
func AnalyzePipelineFailure ¶
func AnalyzePipelineFailure(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input AnalyzePipelineFailureInput) (AnalyzePipelineFailureOutput, error)
AnalyzePipelineFailure fetches pipeline details, failed jobs and their traces, then delegates to the MCP sampling capability for failure root cause analysis.
type FindTechnicalDebtInput ¶
type FindTechnicalDebtInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Ref string `json:"ref" jsonschema:"Branch or tag to search in (defaults to default branch)"`
}
FindTechnicalDebtInput defines parameters for LLM-assisted technical debt discovery.
type FindTechnicalDebtOutput ¶
type FindTechnicalDebtOutput struct {
toolutil.HintableOutput
ProjectID string `json:"project_id"`
Analysis string `json:"analysis"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
FindTechnicalDebtOutput holds the LLM analysis of technical debt indicators.
func FindTechnicalDebt ¶
func FindTechnicalDebt(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input FindTechnicalDebtInput) (FindTechnicalDebtOutput, error)
FindTechnicalDebt searches for debt markers (TODO, FIX-ME, HACK, XXX, DEPRECATED) in the project codebase, then delegates to the MCP sampling capability for analysis.
type GenerateMilestoneReportInput ¶
type GenerateMilestoneReportInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MilestoneIID int64 `json:"milestone_iid" jsonschema:"Milestone IID (project-scoped),required"`
}
GenerateMilestoneReportInput defines parameters for LLM-assisted milestone reporting.
type GenerateMilestoneReportOutput ¶
type GenerateMilestoneReportOutput struct {
toolutil.HintableOutput
MilestoneIID int64 `json:"milestone_iid"`
Title string `json:"title"`
Report string `json:"report"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
GenerateMilestoneReportOutput holds the LLM-generated milestone report.
func GenerateMilestoneReport ¶
func GenerateMilestoneReport(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input GenerateMilestoneReportInput) (GenerateMilestoneReportOutput, error)
GenerateMilestoneReport fetches milestone details, its issues and MRs, then delegates to the MCP sampling capability for report generation.
type GenerateReleaseNotesInput ¶
type GenerateReleaseNotesInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
From string `json:"from" jsonschema:"Starting ref: tag, branch or SHA,required"`
To string `json:"to" jsonschema:"Ending ref: tag, branch or SHA (defaults to HEAD)"`
}
GenerateReleaseNotesInput defines parameters for LLM-assisted release notes generation.
type GenerateReleaseNotesOutput ¶
type GenerateReleaseNotesOutput struct {
toolutil.HintableOutput
From string `json:"from"`
To string `json:"to"`
ReleaseNotes string `json:"release_notes"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
GenerateReleaseNotesOutput holds the LLM-generated release notes.
func GenerateReleaseNotes ¶
func GenerateReleaseNotes(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input GenerateReleaseNotesInput) (GenerateReleaseNotesOutput, error)
GenerateReleaseNotes fetches commits, diffs, and merged MRs between two refs, then delegates to the MCP sampling capability for LLM-generated release notes. Returns sampling.ErrSamplingNotSupported if the client lacks sampling support.
type IssueContextResult ¶
type IssueContextResult struct {
IID int64
Title string
Content string // Formatted Markdown ready for LLM
}
IssueContextResult holds the GraphQL-fetched issue context.
func BuildIssueContext ¶
func BuildIssueContext(ctx context.Context, client *gitlabclient.Client, projectPath string, issueIID int64) (IssueContextResult, error)
BuildIssueContext fetches issue details, notes, participants, time tracking, labels, assignees, milestone, and related MRs in a single GraphQL request. This replaces up to 6 sequential REST calls used by analyze_issue_scope.
type MRContextResult ¶
type MRContextResult struct {
IID int64
Title string
Content string // Formatted Markdown ready for LLM
}
MRContextResult holds the GraphQL-fetched merge request context.
func BuildMRContext ¶
func BuildMRContext(ctx context.Context, client *gitlabclient.Client, projectPath string, mrIID int64) (MRContextResult, error)
BuildMRContext fetches MR details, discussions, approval state, and head pipeline status in a single GraphQL request and formats it as Markdown. The projectPath must be the full path (e.g. "group/project"), not a numeric ID.
type PipelineContextResult ¶
type PipelineContextResult struct {
PipelineIID int64
Status string
Ref string
Content string // Formatted Markdown ready for LLM
FailedJobIDs []int64 // Job IDs of failed jobs (for REST trace fetching)
}
PipelineContextResult holds the GraphQL-fetched pipeline context.
func BuildPipelineContext ¶
func BuildPipelineContext(ctx context.Context, client *gitlabclient.Client, projectPath string, pipelineIID int64) (PipelineContextResult, error)
BuildPipelineContext fetches pipeline details with stages and jobs in a single GraphQL request. Job traces are not available via GraphQL and must be fetched separately via REST. The returned FailedJobIDs can be used for trace retrieval.
type ReviewMRSecurityInput ¶
type ReviewMRSecurityInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"mr_iid" jsonschema:"Merge request internal ID,required"`
}
ReviewMRSecurityInput defines parameters for LLM-assisted MR security review.
type ReviewMRSecurityOutput ¶
type ReviewMRSecurityOutput struct {
toolutil.HintableOutput
MRIID int64 `json:"mr_iid"`
Title string `json:"title"`
Review string `json:"review"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
ReviewMRSecurityOutput holds the LLM security review of an MR.
func ReviewMRSecurity ¶
func ReviewMRSecurity(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input ReviewMRSecurityInput) (ReviewMRSecurityOutput, error)
ReviewMRSecurity fetches an MR and its diffs, then delegates to the MCP sampling capability for a security-focused code review.
type SummarizeIssueInput ¶
type SummarizeIssueInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path"`
IssueIID int64 `json:"issue_iid" jsonschema:"Issue internal ID"`
}
SummarizeIssueInput defines parameters for LLM-assisted issue summarization.
type SummarizeIssueOutput ¶
type SummarizeIssueOutput struct {
toolutil.HintableOutput
IssueIID int64 `json:"issue_iid"`
Title string `json:"title"`
Summary string `json:"summary"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
SummarizeIssueOutput holds the LLM summary of an issue.
func SummarizeIssue ¶
func SummarizeIssue(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input SummarizeIssueInput) (SummarizeIssueOutput, error)
SummarizeIssue fetches an issue and its notes, then delegates to the MCP client's sampling capability for LLM-assisted summarization of the discussion. Returns sampling.ErrSamplingNotSupported if the client lacks sampling support.
type SummarizeMRReviewInput ¶
type SummarizeMRReviewInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"mr_iid" jsonschema:"Merge request internal ID,required"`
}
SummarizeMRReviewInput defines parameters for LLM-assisted MR review summarization.
type SummarizeMRReviewOutput ¶
type SummarizeMRReviewOutput struct {
toolutil.HintableOutput
MRIID int64 `json:"mr_iid"`
Title string `json:"title"`
Summary string `json:"summary"`
Model string `json:"model"`
Truncated bool `json:"truncated"`
}
SummarizeMRReviewOutput holds the LLM summary of an MR review.
func SummarizeMRReview ¶
func SummarizeMRReview(ctx context.Context, req *mcp.CallToolRequest, client *gitlabclient.Client, input SummarizeMRReviewInput) (SummarizeMRReviewOutput, error)
SummarizeMRReview fetches an MR, its discussions, and approval state, then delegates to the MCP sampling capability for review summarization.
Source Files
¶
- analyze_ci_config.go
- analyze_deployment_history.go
- analyze_issue_scope.go
- analyze_mr_changes.go
- analyze_pipeline_failure.go
- common.go
- find_technical_debt.go
- generate_milestone_report.go
- generate_release_notes.go
- graphql_context.go
- graphql_queries.go
- markdown.go
- register.go
- review_mr_security.go
- summarize_issue.go
- summarize_mr_review.go