Documentation
¶
Overview ¶
Package markdown implements MCP tools for rendering GitLab-flavored Markdown.
The package wraps the GitLab Markdown API:
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionSpecs ¶
func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
ActionSpecs returns canonical specs for Markdown rendering actions exposed as MCP tools. The render route is projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).
func FormatRenderMarkdown ¶
func FormatRenderMarkdown(out RenderOutput) *mcp.CallToolResult
FormatRenderMarkdown wraps the RenderOutput HTML in an mcp.CallToolResult with a Markdown heading so downstream agents see a stable structure even when the rendered HTML is empty.
The HTML is fenced rather than concatenated into the page. What GitLab returns here is a document of tags built from text anybody who can write an issue or a comment could have supplied, and a response that pastes it in hands the client whatever that document says: with raw HTML enabled a client renders a live anchor to whatever host the content names, and with raw HTML suppressed it silently drops the tag and shows neither the link nor the fact that one was removed. Escaping is the wrong answer for this one tool, because returning the rendered HTML is what it is for, so the answer is containment: a fence sized by toolutil.MarkdownFencedBlock, which no run of backticks in the document can close, under a line saying whose HTML it is.
Types ¶
type RenderInput ¶
type RenderInput struct {
Text string `json:"text" jsonschema:"Markdown text to render,required"`
GFM bool `json:"gfm,omitempty" jsonschema:"Use GitLab Flavored Markdown (default false)"`
Project string `json:"project,omitempty" jsonschema:"Project path for resolving references (e.g. group/project)"`
}
RenderInput is the input for rendering markdown.
type RenderOutput ¶
type RenderOutput struct {
toolutil.HintableOutput
HTML string `json:"html"`
}
RenderOutput is the output containing the rendered HTML.
func Render ¶
func Render(ctx context.Context, client *gitlabclient.Client, input RenderInput) (RenderOutput, error)
Render sends arbitrary Markdown text to the GitLab Markdown render API (POST /markdown) and returns the resulting HTML. When GFM is true, GitLab Flavored Markdown extensions are applied; an optional Project enables reference resolution (e.g. issue/MR links).