mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2026-08-27 10:37:44 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user