(text: string)
| 71 | ) |
| 72 | |
| 73 | function unwrapResults(text: string): string { |
| 74 | const trimmed = text.trim() |
| 75 | if (!trimmed.startsWith('{')) return text |
| 76 | try { |
| 77 | const parsed = resultsEnvelopeSchema().safeParse(jsonParse(trimmed)) |
| 78 | if (parsed.success) return parsed.data.results |
| 79 | } catch { |
| 80 | // jsonParse threw — fall through |
| 81 | } |
| 82 | return text |
| 83 | } |
| 84 | |
| 85 | // Parse channel names from slack_search_channels text output. |
| 86 | // The Slack MCP server returns markdown with "Name: #channel-name" lines. |
no test coverage detected