Replies: 1 comment 1 reply
|
I have the same question. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
An agent preset with
mode: code(orboth) renders every visible tool into the generatedtools:sdkprompt section. If any tool'sdescription(or a schema property description) contains a literal{{...}}— for example an MCP server that documents template placeholders — prompt assembly throws and the whole turn fails:Reproduction
{{...}}(for example theofficecliMCP server, whose tool description includes...scan for leftover placeholders (xxxx, lorem/ipsum, <TODO>, {{...}}, $VAR$...)).mode: code.Root cause
The SDK section text is produced by
renderToolsSdk(packages/core/tools/src/ts-types.ts) andrenderToolsSdkPy(packages/core/tools/src/py-types.ts). Tool and property descriptions are embedded into that text (JSDoc comments / docstrings) throughdocLines/describe, which escape*/(and quotes/backslashes on the Python side) but do not escape adjacent{{.The
system-promptstrict interpolation (interpolateinpackages/core/system-prompt/src/index.ts) then scans every section for complete{{name}}groups and rejects{{...}}as a malformed variable reference. So any third-party tool description containing a{{…}}placeholder breaks assembly.Suggested fix
Escape adjacent
{{while collapsing descriptions so no complete{{…}}group can form, e.g..replace(/{(?={)/g, '{ ')in bothdocLines(ts-types.ts) anddescribe(py-types.ts). I've applied exactly this on a local checkout and it resolves the failure; I also added regression tests topackages/core/tools/tests/ts-types.spec.tsandpy-types.spec.ts.All reactions