|
|
@@ -446,6 +446,16 @@ const DeleteDeployKeySchema = z.object({
|
|
|
keyId: z.number().describe('Deploy key ID to delete'),
|
|
|
});
|
|
|
|
|
|
+const RenderMarkdownSchema = z.object({
|
|
|
+ text: z.string().describe('Markdown text to render'),
|
|
|
+ mode: z.enum(['gfm', 'markdown']).optional().describe('Rendering mode: "gfm" for GitHub Flavored Markdown (default) or "markdown" for standard Markdown'),
|
|
|
+ context: z.string().optional().describe('Repository context in the format "owner/repo" for repository-aware rendering (e.g., for issue references)'),
|
|
|
+});
|
|
|
+
|
|
|
+const RenderMarkdownRawSchema = z.object({
|
|
|
+ text: z.string().describe('Raw markdown text to render to HTML'),
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* Create and configure an MCP server with all tools and handlers
|
|
|
*/
|
|
|
@@ -2107,6 +2117,43 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
required: ['owner', 'repo', 'keyId'],
|
|
|
},
|
|
|
},
|
|
|
+ {
|
|
|
+ name: 'render_markdown',
|
|
|
+ description: 'Render markdown text to HTML with support for GitHub Flavored Markdown (GFM) and repository context',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ text: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Markdown text to render',
|
|
|
+ },
|
|
|
+ mode: {
|
|
|
+ type: 'string',
|
|
|
+ enum: ['gfm', 'markdown'],
|
|
|
+ description: 'Rendering mode: "gfm" for GitHub Flavored Markdown (default) or "markdown" for standard Markdown',
|
|
|
+ },
|
|
|
+ context: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Repository context in the format "owner/repo" for repository-aware rendering (e.g., for issue references)',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['text'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'render_markdown_raw',
|
|
|
+ description: 'Render raw markdown text to HTML (simpler endpoint, plain text input)',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ text: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Raw markdown text to render to HTML',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['text'],
|
|
|
+ },
|
|
|
+ },
|
|
|
],
|
|
|
};
|
|
|
});
|
|
|
@@ -3157,6 +3204,36 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ case 'render_markdown': {
|
|
|
+ const { text, mode, context } = RenderMarkdownSchema.parse(args);
|
|
|
+ const html = await gogsClient.renderMarkdown({
|
|
|
+ text,
|
|
|
+ mode,
|
|
|
+ context,
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: html,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'render_markdown_raw': {
|
|
|
+ const { text } = RenderMarkdownRawSchema.parse(args);
|
|
|
+ const html = await gogsClient.renderMarkdownRaw(text);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: html,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
default:
|
|
|
throw new Error(`Unknown tool: ${name}`);
|
|
|
}
|