Skip to content

Commit 5f64a0f

Browse files
committed
Use jsdoc comments for tool descriptions so they appear on hover in IDE
1 parent 9cba62d commit 5f64a0f

File tree

2 files changed

+50
-50
lines changed

2 files changed

+50
-50
lines changed

common/src/tools/compile-tool-definitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function jsonSchemaToTypeScript(schema: any): string {
7777
([key, prop]: [string, any]) => {
7878
const isOptional = !schema.required?.includes(key)
7979
const propType = getTypeFromJsonSchema(prop)
80-
const comment = prop.description ? ` // ${prop.description}\n` : ''
80+
const comment = prop.description ? ` /** ${prop.description} */\n` : ''
8181
return `${comment} "${key}"${isOptional ? '?' : ''}: ${propType}`
8282
},
8383
)

common/src/util/types/tools.d.ts

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -65,49 +65,49 @@ export interface AddMessageParams {
6565
* Add a new subgoal for tracking progress. To be used for complex requests that can't be solved in a single step, as you may forget what happened!
6666
*/
6767
export interface AddSubgoalParams {
68-
// A unique identifier for the subgoal. Try to choose the next sequential integer that is not already in use.
68+
/** A unique identifier for the subgoal. Try to choose the next sequential integer that is not already in use. */
6969
id: string
70-
// The objective of the subgoal, concisely and clearly stated.
70+
/** The objective of the subgoal, concisely and clearly stated. */
7171
objective: string
72-
// The status of the subgoal.
72+
/** The status of the subgoal. */
7373
status: 'NOT_STARTED' | 'IN_PROGRESS' | 'COMPLETE' | 'ABORTED'
74-
// A plan for the subgoal.
74+
/** A plan for the subgoal. */
7575
plan?: string
76-
// A log message for the subgoal progress.
76+
/** A log message for the subgoal progress. */
7777
log?: string
7878
}
7979

8080
/**
8181
* Parameters for browser_logs tool
8282
*/
8383
export interface BrowserLogsParams {
84-
// The type of browser action to perform (e.g., "navigate").
84+
/** The type of browser action to perform (e.g., "navigate"). */
8585
type: string
86-
// The URL to navigate to.
86+
/** The URL to navigate to. */
8787
url: string
88-
// When to consider navigation successful. Defaults to 'load'.
88+
/** When to consider navigation successful. Defaults to 'load'. */
8989
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0'
9090
}
9191

9292
/**
9393
* Search for string patterns in the project's files. This tool uses ripgrep (rg), a fast line-oriented search tool. Use this tool only when read_files is not sufficient to find the files you need.
9494
*/
9595
export interface CodeSearchParams {
96-
// The pattern to search for.
96+
/** The pattern to search for. */
9797
pattern: string
98-
// Optional ripgrep flags to customize the search (e.g., "-i" for case-insensitive, "-t ts" for TypeScript files only, "-A 3" for 3 lines after match, "-B 2" for 2 lines before match, "--type-not test" to exclude test files).
98+
/** Optional ripgrep flags to customize the search (e.g., "-i" for case-insensitive, "-t ts" for TypeScript files only, "-A 3" for 3 lines after match, "-B 2" for 2 lines before match, "--type-not test" to exclude test files). */
9999
flags?: string
100-
// Optional working directory to search within, relative to the project root. Defaults to searching the entire project.
100+
/** Optional working directory to search within, relative to the project root. Defaults to searching the entire project. */
101101
cwd?: string
102102
}
103103

104104
/**
105105
* Generate a detailed markdown plan for complex tasks.
106106
*/
107107
export interface CreatePlanParams {
108-
// The path including the filename of a markdown file that will be overwritten with the plan.
108+
/** The path including the filename of a markdown file that will be overwritten with the plan. */
109109
path: string
110-
// A detailed plan to solve the user's request.
110+
/** A detailed plan to solve the user's request. */
111111
plan: string
112112
}
113113

@@ -120,61 +120,61 @@ export interface EndTurnParams {}
120120
* Find several files related to a brief natural language description of the files or the name of a function or class you are looking for.
121121
*/
122122
export interface FindFilesParams {
123-
// A brief natural language description of the files or the name of a function or class you are looking for. It's also helpful to mention a directory or two to look within.
123+
/** A brief natural language description of the files or the name of a function or class you are looking for. It's also helpful to mention a directory or two to look within. */
124124
prompt: string
125125
}
126126

127127
/**
128128
* Fetch up-to-date documentation for libraries and frameworks using Context7 API.
129129
*/
130130
export interface ReadDocsParams {
131-
// The exact library or framework name (e.g., "Next.js", "MongoDB", "React"). Use the official name as it appears in documentation, not a search query.
131+
/** The exact library or framework name (e.g., "Next.js", "MongoDB", "React"). Use the official name as it appears in documentation, not a search query. */
132132
libraryTitle: string
133-
// Optional specific topic to focus on (e.g., "routing", "hooks", "authentication")
133+
/** Optional specific topic to focus on (e.g., "routing", "hooks", "authentication") */
134134
topic?: string
135-
// Optional maximum number of tokens to return. Defaults to 10000. Values less than 10000 are automatically increased to 10000.
135+
/** Optional maximum number of tokens to return. Defaults to 10000. Values less than 10000 are automatically increased to 10000. */
136136
max_tokens?: number
137137
}
138138

139139
/**
140140
* Read the multiple files from disk and return their contents. Use this tool to read as many files as would be helpful to answer the user's request.
141141
*/
142142
export interface ReadFilesParams {
143-
// List of file paths to read.
143+
/** List of file paths to read. */
144144
paths: string[]
145145
}
146146

147147
/**
148148
* Parameters for run_file_change_hooks tool
149149
*/
150150
export interface RunFileChangeHooksParams {
151-
// List of file paths that were changed and should trigger file change hooks
151+
/** List of file paths that were changed and should trigger file change hooks */
152152
files: string[]
153153
}
154154

155155
/**
156156
* Execute a CLI command from the **project root** (different from the user's cwd).
157157
*/
158158
export interface RunTerminalCommandParams {
159-
// CLI command valid for user's OS.
159+
/** CLI command valid for user's OS. */
160160
command: string
161-
// Either SYNC (waits, returns output) or BACKGROUND (runs in background). Default SYNC
161+
/** Either SYNC (waits, returns output) or BACKGROUND (runs in background). Default SYNC */
162162
process_type: 'SYNC' | 'BACKGROUND'
163-
// The working directory to run the command in. Default is the project root.
163+
/** The working directory to run the command in. Default is the project root. */
164164
cwd?: string
165-
// Set to -1 for no timeout. Does not apply for BACKGROUND commands. Default 30
165+
/** Set to -1 for no timeout. Does not apply for BACKGROUND commands. Default 30 */
166166
timeout_seconds: number
167167
}
168168

169169
/**
170170
* Send a message to another agent (parent or child) for communication and data exchange.
171171
*/
172172
export interface SendAgentMessageParams {
173-
// ID of the target agent to send message to. Use "PARENT_ID" to send to parent agent.
173+
/** ID of the target agent to send message to. Use "PARENT_ID" to send to parent agent. */
174174
target_agent_id: string
175-
// Message prompt to send to the target agent
175+
/** Message prompt to send to the target agent */
176176
prompt: string
177-
// Optional parameters object to send with the message
177+
/** Optional parameters object to send with the message */
178178
params?: Record<string, any>
179179
}
180180

@@ -198,11 +198,11 @@ export interface SetOutputParams {}
198198
*/
199199
export interface SpawnAgentsParams {
200200
agents: {
201-
// Agent to spawn
201+
/** Agent to spawn */
202202
agent_type: string
203-
// Prompt to send to the agent
203+
/** Prompt to send to the agent */
204204
prompt?: string
205-
// Parameters object for the agent (if any)
205+
/** Parameters object for the agent (if any) */
206206
params?: Record<string, any>
207207
}[]
208208
}
@@ -212,11 +212,11 @@ export interface SpawnAgentsParams {
212212
*/
213213
export interface SpawnAgentsAsyncParams {
214214
agents: {
215-
// Agent to spawn
215+
/** Agent to spawn */
216216
agent_type: string
217-
// Prompt to send to the agent
217+
/** Prompt to send to the agent */
218218
prompt?: string
219-
// Parameters object for the agent (if any)
219+
/** Parameters object for the agent (if any) */
220220
params?: Record<string, any>
221221
}[]
222222
}
@@ -225,25 +225,25 @@ export interface SpawnAgentsAsyncParams {
225225
* Spawn a single agent that runs within the current message history.
226226
*/
227227
export interface SpawnAgentInlineParams {
228-
// Agent to spawn
228+
/** Agent to spawn */
229229
agent_type: string
230-
// Prompt to send to the agent
230+
/** Prompt to send to the agent */
231231
prompt?: string
232-
// Parameters object for the agent (if any)
232+
/** Parameters object for the agent (if any) */
233233
params?: Record<string, any>
234234
}
235235

236236
/**
237237
* Replace strings in a file with new strings.
238238
*/
239239
export interface StrReplaceParams {
240-
// The path to the file to edit.
240+
/** The path to the file to edit. */
241241
path: string
242-
// Array of replacements to make.
242+
/** Array of replacements to make. */
243243
replacements: {
244-
// The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation.
244+
/** The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. */
245245
old: string
246-
// The string to replace the corresponding old string with. Can be empty to delete.
246+
/** The string to replace the corresponding old string with. Can be empty to delete. */
247247
new: string
248248
}[]
249249
}
@@ -252,43 +252,43 @@ export interface StrReplaceParams {
252252
* Deeply consider complex tasks by brainstorming approaches and tradeoffs step-by-step.
253253
*/
254254
export interface ThinkDeeplyParams {
255-
// Detailed step-by-step analysis. Initially keep each step concise (max ~5-7 words per step).
255+
/** Detailed step-by-step analysis. Initially keep each step concise (max ~5-7 words per step). */
256256
thought: string
257257
}
258258

259259
/**
260260
* Update a subgoal in the context given the id, and optionally the status or plan, or a new log to append. Feel free to update any combination of the status, plan, or log in one invocation.
261261
*/
262262
export interface UpdateSubgoalParams {
263-
// The id of the subgoal to update.
263+
/** The id of the subgoal to update. */
264264
id: string
265-
// Change the status of the subgoal.
265+
/** Change the status of the subgoal. */
266266
status?: 'NOT_STARTED' | 'IN_PROGRESS' | 'COMPLETE' | 'ABORTED'
267-
// Change the plan for the subgoal.
267+
/** Change the plan for the subgoal. */
268268
plan?: string
269-
// Add a log message to the subgoal. This will create a new log entry and append it to the existing logs. Use this to record your progress and any new information you learned as you go.
269+
/** Add a log message to the subgoal. This will create a new log entry and append it to the existing logs. Use this to record your progress and any new information you learned as you go. */
270270
log?: string
271271
}
272272

273273
/**
274274
* Search the web for current information using Linkup API.
275275
*/
276276
export interface WebSearchParams {
277-
// The search query to find relevant web content
277+
/** The search query to find relevant web content */
278278
query: string
279-
// Search depth - 'standard' for quick results, 'deep' for more comprehensive search. Default is 'standard'.
279+
/** Search depth - 'standard' for quick results, 'deep' for more comprehensive search. Default is 'standard'. */
280280
depth: 'standard' | 'deep'
281281
}
282282

283283
/**
284284
* Create or edit a file with the given content.
285285
*/
286286
export interface WriteFileParams {
287-
// Path to the file relative to the **project root**
287+
/** Path to the file relative to the **project root** */
288288
path: string
289-
// What the change is intended to do in only one sentence.
289+
/** What the change is intended to do in only one sentence. */
290290
instructions: string
291-
// Edit snippet to apply to the file.
291+
/** Edit snippet to apply to the file. */
292292
content: string
293293
}
294294

0 commit comments

Comments
 (0)