Skip to content

Conversation

chezsmithy
Copy link
Contributor

@chezsmithy chezsmithy commented Oct 21, 2025

Description

Noticed the CLI and Core "Tool" type had a misaslignment around how a function was defined. This change aligns the function defintion making it easier to share tools between core and the cli. Also eliminates potential issues in the OpenAPI adapters when using tools between core and the cli.

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

Updated tests as needed.


Summary by cubic

Refactors the CLI Tool type to use a function schema (type: "function" with function {name, description, parameters}), aligning with core and preventing mismatches. This makes tools shareable between core and CLI and avoids OpenAPI adapter issues.

  • Refactors

    • Tool type now: type "function" with a function object holding name, description, and parameters.
    • Updated all built-in tools and MCP tool mapping to the new shape.
    • Switched lookups and validation to function.name and function.parameters.
    • Updated permission checks, tool discovery/handling, and tests to the new API.
  • Migration

    • Update custom CLI tools to include type: "function" and move name/description/parameters into tool.function.
    • Replace references to tool.name/description/parameters with tool.function.name/description/parameters.
    • Ensure allowlists/filters use function.name.

@chezsmithy chezsmithy requested a review from a team as a code owner October 21, 2025 19:11
@chezsmithy chezsmithy requested review from tingwai and removed request for a team October 21, 2025 19:11
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Oct 21, 2025
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 21 files

Prompt for AI agents (all 1 issues)

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


<file name="extensions/cli/src/tools/index.tsx">

<violation number="1" location="extensions/cli/src/tools/index.tsx:253">
Iterating over the schema object means you only ever see keys like &quot;type&quot; and &quot;properties&quot;, so required argument names are never checked. Please iterate over `tool.function.parameters.properties` instead.</violation>
</file>

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

const requiredParams = tool.parameters.required ?? [];
for (const [paramName] of Object.entries(tool.parameters)) {
const requiredParams = tool.function.parameters.required ?? [];
for (const [paramName] of Object.entries(tool.function.parameters)) {
Copy link
Contributor

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

Choose a reason for hiding this comment

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

Iterating over the schema object means you only ever see keys like "type" and "properties", so required argument names are never checked. Please iterate over tool.function.parameters.properties instead.

Prompt for AI agents
Address the following comment on extensions/cli/src/tools/index.tsx at line 253:

<comment>Iterating over the schema object means you only ever see keys like &quot;type&quot; and &quot;properties&quot;, so required argument names are never checked. Please iterate over `tool.function.parameters.properties` instead.</comment>

<file context>
@@ -246,8 +249,8 @@ export async function executeToolCall(
-  const requiredParams = tool.parameters.required ?? [];
-  for (const [paramName] of Object.entries(tool.parameters)) {
+  const requiredParams = tool.function.parameters.required ?? [];
+  for (const [paramName] of Object.entries(tool.function.parameters)) {
     if (
       requiredParams.includes(paramName) &amp;&amp;
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant