@wonderwhy-er/desktop-commander
Version:
MCP server for terminal operations and file editing
16 lines (15 loc) • 438 B
JavaScript
export function extractInlineText(token) {
if (!token) {
return '';
}
const children = Array.isArray(token.children) ? token.children : [];
if (children.length === 0) {
return typeof token.content === 'string' ? token.content : '';
}
return children.map((child) => {
if (typeof child.content === 'string') {
return child.content;
}
return '';
}).join('');
}