Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(mcp-host): say PPTX text is plain and note markdown sent into it
marcotebff81ce63582e
diff --git a/mcp-host/src/workflow/__tests__/internalTools.pptx.test.ts b/mcp-host/src/workflow/__tests__/internalTools.pptx.test.tsindex 2b9b0c21a..756116d48 100644--- a/mcp-host/src/workflow/__tests__/internalTools.pptx.test.ts+++ b/mcp-host/src/workflow/__tests__/internalTools.pptx.test.ts@@ -331,6 +331,38 @@ describe('clerum__generate_pptx — quota enforcement', () => {// ─── Speaker notes ─────────────────────────────────────────────────+describe('clerum__generate_pptx — plain text', () => {+ it('says once that slides print markdown as written, and not for ordinary text', async () => {+ const tool = findTool('clerum__generate_pptx')+ const marked = await tool.execute(+ {+ filename: 'm.pptx',+ slides: [+ {+ layout: 'title-bullets',+ title: 'Results',+ bullets: ['**Revenue** grew 12%', 'Use `npm ci` first'],+ },+ ],+ },+ testOutputDir+ )+ expect(marked.success, marked.error).toBe(true)+ const notes = marked.content ?? ''+ expect(notes).toContain('slides[0].bullets[0] holds markdown or HTML')+ expect(notes.match(/holds markdown or HTML/g)).toHaveLength(1)++ const plain = await tool.execute(+ {+ filename: 'p.pptx',+ slides: [{ layout: 'title-bullets', title: 'Math', bullets: ['2*3*4 = 24', 'snake_case'] }],+ },+ testOutputDir+ )+ expect(plain.content ?? '').not.toContain('markdown')+ })+})+describe('clerum__generate_pptx — speaker notes', () => {it('attaches notes without crashing the writer', async () => {const tool = findTool('clerum__generate_pptx')diff --git a/mcp-host/src/workflow/internalTools.ts b/mcp-host/src/workflow/internalTools.tsindex 0a375b76a..291be04d3 100644--- a/mcp-host/src/workflow/internalTools.ts+++ b/mcp-host/src/workflow/internalTools.ts@@ -5871,8 +5871,8 @@ const generatePptxTool: InternalToolDefinition = {description:'Generate a styled PowerPoint (.pptx) deck: set `template` and fill `data`, or pass ' +'`slides[]`, each with a `layout`. A list of texts may also be one string, one item per ' +- 'line. Lists, tables and KPI cards that do not fit continue on further slides and long ' +- 'text is set smaller; the result says when.',+ 'line. Text is plain: markdown is not read. Lists, tables and KPI cards that do not fit ' ++ 'continue on further slides and long text is set smaller; the result says when.',parameters: {type: 'object',properties: {diff --git a/mcp-host/src/workflow/pptxInput.ts b/mcp-host/src/workflow/pptxInput.tsindex b2f4c3fb4..054cbf61e 100644--- a/mcp-host/src/workflow/pptxInput.ts+++ b/mcp-host/src/workflow/pptxInput.ts@@ -121,8 +121,18 @@ export function fieldPath(slide: PptxSlide, field: string): string {export interface ReadContext {outputDir: stringwarnings: string[]+ /** Set once a text field holding markup has been reported. */+ markupNoted?: boolean}+/**+ * Markdown and HTML a model writes into text that a slide prints as it is:+ * **bold**, `code`, [label](url) and <b>, <i>, <strong>, <em> or <br>. A single+ * asterisk is left alone, since 2*3*4 is ordinary text.+ */+const MARKUP =+ /\*\*[^*\s][^*]*\*\*|`[^`\n]+`|\[[^[\]\n]+\]\((?:https?:|mailto:)[^)\s]+\)|<\/?(?:b|i|strong|em|br)\b[^<>]*>/i+export function isRecord(value: unknown): value is Record<string, unknown> {return value !== null && typeof value === 'object' && !Array.isArray(value)}@@ -157,6 +167,13 @@ export function readText(}const text = raw.trim()if (!text) return undefined+ if (!ctx.markupNoted && MARKUP.test(text)) {+ ctx.markupNoted = true+ ctx.warnings.push(+ `${where} holds markdown or HTML, which slides print as written; PPTX text is plain, ` ++ 'so send it without **bold**, `code`, [label](url) or tags.'+ )+ }if (Array.from(text).length > max) {ctx.warnings.push(`${where} is longer than ${max} characters and was shortened.`)return shorten(text, max)