Documentation
¶
Overview ¶
markdown.go provides Markdown formatting functions for wiki MCP tool output.
register.go wires wikis MCP tools to the MCP server.
Package wikis implements MCP tool handlers for GitLab project wiki operations including list, get, create, update, and delete pages. It wraps the Wikis service from client-go v2.
Index ¶
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func FormatAttachmentMarkdown(o AttachmentOutput) *mcp.CallToolResult
- func FormatAttachmentMarkdownString(o AttachmentOutput) string
- func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
- func FormatListMarkdownString(out ListOutput) string
- func FormatOutputMarkdown(w Output) *mcp.CallToolResult
- func FormatOutputMarkdownString(w Output) string
- func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
- type AttachmentOutput
- type CreateInput
- type DeleteInput
- type GetInput
- type ListInput
- type ListOutput
- type Output
- type UpdateInput
- type UploadAttachmentInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete deletes a wiki page identified by slug from a GitLab project.
func FormatAttachmentMarkdown ¶
func FormatAttachmentMarkdown(o AttachmentOutput) *mcp.CallToolResult
FormatAttachmentMarkdown returns an MCP tool result for a wiki attachment upload.
func FormatAttachmentMarkdownString ¶
func FormatAttachmentMarkdownString(o AttachmentOutput) string
FormatAttachmentMarkdownString renders a wiki attachment upload result as Markdown.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
FormatListMarkdown returns an MCP tool result for a wiki page list.
func FormatListMarkdownString ¶
func FormatListMarkdownString(out ListOutput) string
FormatListMarkdownString formats a list of wiki pages as a Markdown table.
func FormatOutputMarkdown ¶
func FormatOutputMarkdown(w Output) *mcp.CallToolResult
FormatOutputMarkdown returns an MCP tool result for a single wiki page.
func FormatOutputMarkdownString ¶
FormatOutputMarkdownString formats a single wiki page as Markdown.
func RegisterTools ¶
func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
RegisterTools registers wiki-related tools on the MCP server.
Types ¶
type AttachmentOutput ¶
type AttachmentOutput struct {
toolutil.HintableOutput
FileName string `json:"file_name"`
FilePath string `json:"file_path"`
Branch string `json:"branch"`
URL string `json:"url"`
Markdown string `json:"markdown"`
}
AttachmentOutput represents the result of a wiki attachment upload.
func UploadAttachment ¶
func UploadAttachment(ctx context.Context, client *gitlabclient.Client, input UploadAttachmentInput) (AttachmentOutput, error)
UploadAttachment uploads a file attachment to a project wiki.
type CreateInput ¶
type CreateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Title string `json:"title" jsonschema:"Title of the wiki page,required"`
Content string `json:"content" jsonschema:"Content of the wiki page (Markdown, RDoc, AsciiDoc, or Org),required"`
Format string `json:"format,omitempty" jsonschema:"Content format: markdown (default), rdoc, asciidoc, or org"`
}
CreateInput defines parameters for creating a new wiki page.
type DeleteInput ¶
type DeleteInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Slug string `json:"slug" jsonschema:"URL-encoded slug of the wiki page to delete,required"`
}
DeleteInput defines parameters for deleting a wiki page.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Slug string `json:"slug" jsonschema:"URL-encoded slug of the wiki page (e.g. 'my-page'),required"`
RenderHTML bool `json:"render_html,omitempty" jsonschema:"Return HTML-rendered content instead of raw format"`
Version string `json:"version,omitempty" jsonschema:"Wiki page version SHA to retrieve a specific revision"`
}
GetInput defines parameters for retrieving a single wiki page.
type ListInput ¶
type ListInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
WithContent bool `json:"with_content,omitempty" jsonschema:"Include page content in the response"`
}
ListInput defines parameters for listing wiki pages in a GitLab project.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
WikiPages []Output `json:"wiki_pages"`
}
ListOutput holds a list of wiki pages.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves all wiki pages for a GitLab project. Optionally includes page content when with_content is true.
type Output ¶
type Output struct {
toolutil.HintableOutput
Title string `json:"title"`
Slug string `json:"slug"`
Format string `json:"format"`
Content string `json:"content,omitempty"`
Encoding string `json:"encoding,omitempty"`
}
Output represents a single wiki page.
func Create ¶
func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
Create creates a new wiki page in the specified GitLab project.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
Update updates an existing wiki page identified by slug. At least one of title, content, or format must be provided.
type UpdateInput ¶
type UpdateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Slug string `json:"slug" jsonschema:"URL-encoded slug of the wiki page to update,required"`
Title string `json:"title,omitempty" jsonschema:"New title for the wiki page"`
Content string `json:"content,omitempty" jsonschema:"New content for the wiki page"`
Format string `json:"format,omitempty" jsonschema:"Content format: markdown, rdoc, asciidoc, or org"`
}
UpdateInput defines parameters for updating an existing wiki page.
type UploadAttachmentInput ¶
type UploadAttachmentInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Filename string `json:"filename" jsonschema:"Name of the file to upload (e.g. diagram.png),required"`
ContentBase64 string `json:"content_base64,omitempty" jsonschema:"Base64-encoded file content. Provide either content_base64 or file_path"`
FilePath string `json:"file_path,omitempty" jsonschema:"Absolute path to a local file. Provide either file_path or content_base64"`
Branch string `json:"branch,omitempty" jsonschema:"Branch to upload the attachment to"`
}
UploadAttachmentInput defines parameters for uploading an attachment to a wiki.