feat(issue): add get_discussion_markdown to issue_read

Adds a new issue_read method that fetches an issue and its comments
and renders them as a single Markdown document, instead of a JSON
array. Formatting logic lives in a pure, unit-tested helper
(formatDiscussionMarkdown) covering comment rendering, empty comment
lists, and attachment-inlined bodies. Existing get/get_comments/
get_labels methods are unchanged.

Co-Authored-By: Codet <codet@commitgo.dev> (GPT-5-Codex)
This commit is contained in:
Lunny Xiao
2026-08-24 00:14:50 -07:00
parent 815a0e26aa
commit 3c6d2ecd6b
5 changed files with 324 additions and 2 deletions
+11
View File
@@ -23,6 +23,17 @@ func TextResult(v any) (*mcp.CallToolResult, error) {
}, nil
}
// RawTextResult returns text as-is, without JSON-encoding it. Use it for
// content that is already meant to be read directly, such as Markdown.
func RawTextResult(text string) (*mcp.CallToolResult, error) {
if flag.Debug {
log.Debugf("Text Result: %s", text)
}
return &mcp.CallToolResult{
Content: []mcp.Content{&mcp.TextContent{Text: text}},
}, nil
}
func ErrorResult(err error) (*mcp.CallToolResult, error) {
log.Errorf("%s", err.Error())
var result mcp.CallToolResult