Elffuss BraidHub

kikocis/continue public

fix: throw error if tool call args are missing
Changeseta92cd8073012b9e1805fc0f58402a29539477447838cbe022f7c406b89d2cf70
AuthorDallin Romney <dallinromney@gmail.com> · 2025-07-20 14:13 +02:00
CommitterDallin Romney <dallinromney@gmail.com> · 2025-07-20 14:13 +02:00
Parents9df0fa5d79c7

Browse the files at this changeset

14 files changed

modified core/tools/definitions/createRuleBlock.ts +1 −1
@@ -16,7 +16,7 @@
1616 'Creates a "rule" that can be referenced in future conversations. This should be used whenever you want to establish code standards / preferences that should be applied consistently, or when you want to avoid making a mistake again. To modify existing rules, use the edit tool instead.\n\nRule Types:\n- Always: Include only "rule" (always included in model context)\n- Auto Attached: Include "rule", "globs", and/or "regex" (included when files match patterns)\n- Agent Requested: Include "rule" and "description" (AI decides when to apply based on description)\n- Manual: Include only "rule" (only included when explicitly mentioned using @ruleName)',
1717 parameters: {
1818 type: "object",
19- required: ["name", "rule", "description"],
19+ required: ["name", "rule"],
2020 properties: {
2121 name: {
2222 type: "string",
modified core/tools/definitions/ls.ts +1 −2
@@ -16,12 +16,11 @@
1616 description: "List files and folders in a given directory",
1717 parameters: {
1818 type: "object",
19- required: ["dirPath", "recursive"],
2019 properties: {
2120 dirPath: {
2221 type: "string",
2322 description:
24- "The directory path relative to the root of the project. Always use forward slash paths like '/'. rather than e.g. '.'",
23+ "The directory path relative to the root of the project. Use forward slash paths like '/'. rather than e.g. '.'",
2524 },
2625 recursive: {
2726 type: "boolean",
modified core/tools/implementations/codebaseTool.ts +2 −8
@@ -3,14 +3,8 @@
33 import { retrieveContextItemsFromEmbeddings } from "../../context/retrieval/retrieval";
44
55 export const codebaseToolImpl: ToolImpl = async (args, extras) => {
6- if (!args.query || args.query.trim() === "") {
7- return [
8- {
9- name: "Error",
10- description: "Codebase search error",
11- content: "Query parameter is required and cannot be empty.",
12- },
13- ];
6+ if (!args?.query || args.query.trim() === "") {
7+ throw new Error("`query` parameter is required and cannot be empty.");
148 }
159
1610 try {
modified core/tools/implementations/createNewFile.ts +8 −0
@@ -4,6 +4,14 @@
44 import { getCleanUriPath, getUriPathBasename } from "../../util/uri";
55
66 export const createNewFileImpl: ToolImpl = async (args, extras) => {
7+ if (!args?.filepath) {
8+ throw new Error("`filepath` argument is required and cannot be empty.");
9+ }
10+ if (args?.contents === undefined) {
11+ throw new Error(
12+ "`contents` argument is required to create a new file (can be empty).",
13+ );
14+ }
715 const resolvedFileUri = await inferResolvedUriFromRelativePath(
816 args.filepath,
917 extras.ide,
modified core/tools/implementations/createRuleBlock.ts +5 −0
@@ -13,6 +13,11 @@
1313 { name, rule, ...otherArgs }: CreateRuleBlockArgs,
1414 extras,
1515 ) => {
16+ if (!name || !rule) {
17+ throw new Error(
18+ "`name` and `rule` arguments are required to create a rule.",
19+ );
20+ }
1621 const fileContent = createRuleMarkdown(name, rule, otherArgs);
1722
1823 const [localContinueDir] = await extras.ide.getWorkspaceDirs();
modified core/tools/implementations/fetchUrlContent.ts +4 −0
@@ -4,6 +4,10 @@
44 const DEFAULT_FETCH_URL_CHAR_LIMIT = 20000;
55
66 export const fetchUrlContentImpl: ToolImpl = async (args, extras) => {
7+ if (!args?.url) {
8+ throw new Error("`url` argument is required and cannot be empty");
9+ }
10+
711 const contextItems = await getUrlContextItems(args.url, extras.fetch);
812
913 // Track truncated content
modified core/tools/implementations/globSearch.ts +6 −0
@@ -2,7 +2,13 @@
22 import { ContextItem } from "../..";
33
44 const MAX_AGENT_GLOB_RESULTS = 100;
5+
56 export const fileGlobSearchImpl: ToolImpl = async (args, extras) => {
7+ if (!args?.pattern) {
8+ throw new Error(
9+ "`pattern` argument is required for a glob search, and cannot be empty",
10+ );
11+ }
612 const results = await extras.ide.getFileResults(
713 args.pattern,
814 MAX_AGENT_GLOB_RESULTS,
modified core/tools/implementations/grepSearch.ts +6 −0
@@ -41,6 +41,12 @@
4141 }
4242
4343 export const grepSearchImpl: ToolImpl = async (args, extras) => {
44+ if (!args?.query) {
45+ throw new Error(
46+ "`query` argument is required for a grep search, and cannot be empty",
47+ );
48+ }
49+
4450 const results = await extras.ide.getSearchResults(
4551 args.query,
4652 DEFAULT_GREP_SEARCH_RESULTS_LIMIT,
modified core/tools/implementations/readFile.ts +6 −0
@@ -5,6 +5,12 @@
55 import { throwIfFileExceedsHalfOfContext } from "./readFileLimit";
66
77 export const readFileImpl: ToolImpl = async (args, extras) => {
8+ if (!args?.filepath) {
9+ throw new Error(
10+ "`filepath` argument is required to read a file, and cannot be empty",
11+ );
12+ }
13+
814 const firstUriMatch = await resolveRelativePathInDir(
915 args.filepath,
1016 extras.ide,
modified core/tools/implementations/requestRule.ts +6 −0
@@ -1,6 +1,12 @@
11 import { ToolImpl } from ".";
22
33 export const requestRuleImpl: ToolImpl = async (args, extras) => {
4+ if (!args?.name) {
5+ throw new Error(
6+ "`name` argument is required to request a rule, and cannot be empty",
7+ );
8+ }
9+
410 // Find the rule by name in the config
511 const rule = extras.config.rules.find((r) => r.name === args.name);
612
modified core/tools/implementations/runTerminalCommand.ts +6 −0
@@ -50,6 +50,12 @@
5050 ];
5151
5252 export const runTerminalCommandImpl: ToolImpl = async (args, extras) => {
53+ if (!args?.command) {
54+ throw new Error(
55+ "`command` argument is required to run a terminal command, and cannot be empty",
56+ );
57+ }
58+
5359 // Default to waiting for completion if not specified
5460 const waitForCompletion = args.waitForCompletion !== false;
5561 const ideInfo = await extras.ide.getIdeInfo();
modified core/tools/implementations/searchWeb.ts +6 −0
@@ -4,6 +4,12 @@
44 const DEFAULT_WEB_SEARCH_CHAR_LIMIT = 8000;
55
66 export const searchWebImpl: ToolImpl = async (args, extras) => {
7+ if (!args?.query) {
8+ throw new Error(
9+ "`query` argument is required to search the web, and cannot be empty",
10+ );
11+ }
12+
713 const webResults = await fetchSearchResults(args.query, 5, extras.fetch);
814
915 // Track truncated results
modified core/tools/implementations/viewSubdirectory.ts +6 −0
@@ -4,7 +4,13 @@
44 import { ToolImpl } from ".";
55
66 export const viewSubdirectoryImpl: ToolImpl = async (args: any, extras) => {
7+ if (!args?.directory_path) {
8+ throw new Error(
9+ "`directory_path` argument is required to view a map of a subdirectory, and cannot be empty",
10+ );
11+ }
712 const { directory_path } = args;
13+
814 const uri = await resolveRelativePathInDir(directory_path, extras.ide);
915
1016 if (!uri) {
modified gui/src/util/clientTools/editImpl.ts +5 −0
@@ -6,6 +6,11 @@
66 toolCallId,
77 extras,
88 ) => {
9+ if (!args.filepath || !args.changes) {
10+ throw new Error(
11+ "`filepath` and `changes` arguments are required to edit an existing file.",
12+ );
13+ }
914 const firstUriMatch = await resolveRelativePathInDir(
1015 args.filepath,
1116 extras.ideMessenger.ide,