Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(mcp-host): report branding keys the PDF and DOCX generators never read

marcoteb20f802a8cfe2
diff --git a/mcp-host/src/workflow/__tests__/schemaArguments.test.ts b/mcp-host/src/workflow/__tests__/schemaArguments.test.ts
index 6c72bcbde..c9195013a 100644
--- a/mcp-host/src/workflow/__tests__/schemaArguments.test.ts
+++ b/mcp-host/src/workflow/__tests__/schemaArguments.test.ts
@@ -150,4 +150,25 @@ describe('a generator called directly, as the chat path does', () => {
fs.rmSync(dir, { recursive: true, force: true })
}
})
+
+ it('reports a branding key PDF and DOCX do not read, as XLSX does', async () => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'clerum-null-args-'))
+ try {
+ for (const [name, args] of [
+ ['pdf', { filename: 'b.pdf', body: 'x' }],
+ ['docx', { filename: 'b.docx', body: 'x' }],
+ ['xlsx', { filename: 'b.xlsx', sheets: [{ name: 'S', rows: [['a'], [1]] }] }],
+ ] as const) {
+ const tool = INTERNAL_TOOLS.find(t => t.name === `clerum__generate_${name}`)!
+ const result = await tool.execute(
+ { ...args, branding: { companyName: 'Acme', bogusBrand: 1 } },
+ dir
+ )
+ expect(result.success, result.error).toBe(true)
+ expect(result.content, name).toContain("'branding.bogusBrand'")
+ }
+ } finally {
+ fs.rmSync(dir, { recursive: true, force: true })
+ }
+ })
})
diff --git a/mcp-host/src/workflow/internalTools.ts b/mcp-host/src/workflow/internalTools.ts
index 291be04d3..7de0176dc 100644
--- a/mcp-host/src/workflow/internalTools.ts
+++ b/mcp-host/src/workflow/internalTools.ts
@@ -1620,8 +1620,9 @@ function printedBranding(raw: unknown): {
value === undefined || value === null ? undefined : String(value)
const companyName = text(branding.companyName)
const footerText = text(branding.footerText)
+ // Named rather than spread, so a key nothing prints is reported as ignored.
return {
- ...branding,
+ ...(branding.logoPath !== undefined ? { logoPath: branding.logoPath as string } : {}),
...(companyName !== undefined ? { companyName: htmlToPlainText(companyName) } : {}),
...(footerText !== undefined ? { footerText: htmlToPlainLines(footerText) } : {}),
}