Skip to main content
Glama
extractTextFromComment.ts1.28 kB
/** * Comment Text Extractor * * This utility extracts plain text content from structured Jira comment objects. * It handles the complex nested structure of Atlassian Document Format (ADF) comments, * recursively traversing content nodes to extract all text elements. The module * provides a consistent approach to accessing comment text regardless of its structure, * enabling reliable text analysis for sentiment detection, keyword extraction, and * other content-based evaluations used in issue metadata assessment. */ import type { IssueComment } from '../../../types/comment' import type { DescriptionContentNode } from '../../../types/issue.types' /** * Extracts text content from a Jira comment object */ export function extractTextFromComment(comment: IssueComment): string { if (!comment.body || !comment.body.content) { return '' } // Similar to description extraction function extractText(content: DescriptionContentNode | DescriptionContentNode[]): string { if (!content) return '' if (Array.isArray(content)) { return content.map(extractText).join(' ') } if (content.text) { return content.text } if (content.content) { return extractText(content.content) } return '' } return extractText(comment.body.content) }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tbreeding/jira-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server