-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Custom tool calling #10083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Custom tool calling #10083
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
16bc0d0
Add `@roo-code/core`
cte 0b9602c
More progress
cte 0183466
Switch to use OpenAI types, speed up validation
cte a1a6b96
Add logging, error handling
cte ea3694d
Add formatters
cte 6ae088e
Fix edge cases with `formatNative`
cte 473a189
Add comments
cte 2f3fa97
Fix tests
cte 8f48005
Fix: Address PR reviewer issues
roomote a5487f6
Merge branch 'main' into cte/core-package
cte 8051064
Try to fix e2e tests
cte 7b12c60
Start using `@roo-code/core` (#10088)
cte f436e7c
Merge branch 'main' into cte/core-package
cte 2212a3a
Minor cleanup
cte 2aff8f8
More cleanup
cte b45c26e
More cleanup
cte d54b37e
Merge branch 'main' into cte/core-package
cte 18acb96
Fix custom tool transpilation and bundling (#10242)
cte 021b4c5
Performance optimization
cte 58ca3c2
Custom tools UI (#10244)
cte 0083691
Add support for global custom tools (#10253)
cte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import type { CustomToolContext, TaskLike } from "@roo-code/types" | ||
|
|
||
| import systemTime from "../system-time.js" | ||
|
|
||
| const mockContext: CustomToolContext = { | ||
| mode: "code", | ||
| task: { taskId: "test-task-id" } as unknown as TaskLike, | ||
| } | ||
|
|
||
| describe("system-time tool", () => { | ||
| describe("execute", () => { | ||
| it("should return a formatted date/time string", async () => { | ||
| const result = await systemTime.execute({}, mockContext) | ||
| expect(result).toMatch(/^The current date and time is:/) | ||
| expect(result).toMatch(/(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)/) | ||
| expect(result).toMatch( | ||
| /(January|February|March|April|May|June|July|August|September|October|November|December)/, | ||
| ) | ||
| expect(result).toMatch(/\d{1,2}:\d{2}:\d{2}/) | ||
| }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { config } from "@roo-code/config-eslint/base" | ||
|
|
||
| /** @type {import("eslint").Linter.Config} */ | ||
| export default [...config] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "name": "@roo-code/custom-tools", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "description": "Custom tools for the Roo Code project itself", | ||
| "scripts": { | ||
| "lint": "eslint . --ext=ts --max-warnings=0", | ||
| "check-types": "tsc --noEmit", | ||
| "test": "vitest run" | ||
| }, | ||
| "devDependencies": { | ||
| "@roo-code/config-eslint": "workspace:^", | ||
| "@roo-code/config-typescript": "workspace:^", | ||
| "@roo-code/types": "workspace:^", | ||
| "vitest": "^3.2.3" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { parametersSchema, defineCustomTool } from "@roo-code/types" | ||
|
|
||
| export default defineCustomTool({ | ||
| name: "system_time", | ||
| description: "Returns the current system date and time in a friendly, human-readable format.", | ||
| parameters: parametersSchema.object({}), | ||
| async execute() { | ||
| const systemTime = new Date().toLocaleString("en-US", { | ||
| weekday: "long", | ||
| year: "numeric", | ||
| month: "long", | ||
| day: "numeric", | ||
| hour: "2-digit", | ||
| minute: "2-digit", | ||
| second: "2-digit", | ||
| timeZoneName: "short", | ||
| timeZone: "America/Los_Angeles", | ||
| }) | ||
|
|
||
| return `The current date and time is: ${systemTime}` | ||
| }, | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "extends": "@roo-code/config-typescript/base.json", | ||
| "compilerOptions": { | ||
| "noEmit": true, | ||
| "types": ["vitest/globals"] | ||
| }, | ||
| "include": ["*.ts", "__tests__/*.ts"], | ||
| "exclude": ["node_modules"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { defineConfig } from "vitest/config" | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| globals: true, | ||
| environment: "node", | ||
| watch: false, | ||
| }, | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { config } from "@roo-code/config-eslint/base" | ||
|
|
||
| /** @type {import("eslint").Linter.Config} */ | ||
| export default [...config] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "name": "@roo-code/core", | ||
| "description": "Platform agnostic core functionality for Roo Code.", | ||
| "version": "0.0.0", | ||
| "type": "module", | ||
| "exports": "./src/index.ts", | ||
| "scripts": { | ||
| "lint": "eslint src --ext=ts --max-warnings=0", | ||
| "check-types": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "clean": "rimraf .turbo" | ||
| }, | ||
| "dependencies": { | ||
| "@roo-code/types": "workspace:^", | ||
| "esbuild": "^0.25.0", | ||
| "execa": "^9.5.2", | ||
| "openai": "^5.12.2", | ||
| "zod": "^3.25.61" | ||
| }, | ||
| "devDependencies": { | ||
| "@roo-code/config-eslint": "workspace:^", | ||
| "@roo-code/config-typescript": "workspace:^", | ||
| "@types/node": "^24.1.0", | ||
| "vitest": "^3.2.3" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.