Skip to content

Conversation

@seefeldb
Copy link
Contributor

@seefeldb seefeldb commented Oct 24, 2025

Adds the ability to pass extra parameters to pattern-based tools in LLM dialog tool invocations. This allows tool definitions to specify additional static parameters that get merged with the LLM-provided input when invoking the underlying pattern.

Changes:

  • Add extraParams field to LLMToolSchema for pattern-based tools
  • Merge extraParams with tool call input when invoking patterns
  • Update calculator pattern to accept optional base parameter
  • Add example usage in default-app with base: 10 for calculator tool

This enables use cases like configuring tool behavior (e.g., number base for calculator) without requiring the LLM to provide those values.


Summary by cubic

Adds extraParams to pattern-based LLM tools so tool definitions can include static params that merge with LLM input at runtime. Updates the calculator tool to accept an optional base; default app shows base: 10.

  • New Features
    • Added extraParams to LLMToolSchema and runtime invocation.
    • Merged extraParams with toolCall.input for pattern executions.
    • Updated calculator pattern to support a base parameter; configured in default-app example.

Adds the ability to pass extra parameters to pattern-based tools in LLM
dialog tool invocations. This allows tool definitions to specify additional
static parameters that get merged with the LLM-provided input when invoking
the underlying pattern.

Changes:
- Add extraParams field to LLMToolSchema for pattern-based tools
- Merge extraParams with tool call input when invoking patterns
- Update calculator pattern to accept optional base parameter
- Add example usage in default-app with base: 10 for calculator tool

This enables use cases like configuring tool behavior (e.g., number base
for calculator) without requiring the LLM to provide those values.
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/patterns/common-tools.tsx">

<violation number="1" location="packages/patterns/common-tools.tsx:34">
Unsanitized `base` allows arbitrary code execution in `Function` call.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

try {
result = Function(`"use strict"; return (${sanitized})`)();
result = Function(
`"use strict"; return Number(${sanitized}).toString(${base} ?? 10)`,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsanitized base allows arbitrary code execution in Function call.

Prompt for AI agents
Address the following comment on packages/patterns/common-tools.tsx at line 34:

<comment>Unsanitized `base` allows arbitrary code execution in `Function` call.</comment>

<file context>
@@ -18,17 +18,21 @@ import {
     try {
-      result = Function(`&quot;use strict&quot;; return (${sanitized})`)();
+      result = Function(
+        `&quot;use strict&quot;; return Number(${sanitized}).toString(${base} ?? 10)`,
+      )();
     } catch (error) {
</file context>
Fix with Cubic

@seefeldb seefeldb closed this Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants