Change getAllTools() to return ToolInfo[] instead of string[]
Breaking change: pi.getAllTools() now returns Array<{ name, description }>
instead of string[]. Extensions needing just names can use .map(t => t.name).
Removes redundant getToolInfo() method added in original PR.
Fixes #647
This commit is contained in:
@@ -99,6 +99,7 @@ export type {
|
||||
ToolCallEventResult,
|
||||
// Tools
|
||||
ToolDefinition,
|
||||
ToolInfo,
|
||||
ToolRenderResultOptions,
|
||||
ToolResultEvent,
|
||||
ToolResultEventResult,
|
||||
|
||||
@@ -187,7 +187,7 @@ function createExtensionAPI(
|
||||
return runtime.getActiveTools();
|
||||
},
|
||||
|
||||
getAllTools(): string[] {
|
||||
getAllTools() {
|
||||
return runtime.getAllTools();
|
||||
},
|
||||
|
||||
|
||||
@@ -743,8 +743,8 @@ export interface ExtensionAPI {
|
||||
/** Get the list of currently active tool names. */
|
||||
getActiveTools(): string[];
|
||||
|
||||
/** Get all configured tools (built-in + extension tools). */
|
||||
getAllTools(): string[];
|
||||
/** Get all configured tools with name and description. */
|
||||
getAllTools(): ToolInfo[];
|
||||
|
||||
/** Set the active tools by name. */
|
||||
setActiveTools(toolNames: string[]): void;
|
||||
@@ -813,7 +813,10 @@ export type GetSessionNameHandler = () => string | undefined;
|
||||
|
||||
export type GetActiveToolsHandler = () => string[];
|
||||
|
||||
export type GetAllToolsHandler = () => string[];
|
||||
/** Tool info with name and description */
|
||||
export type ToolInfo = Pick<ToolDefinition, "name" | "description">;
|
||||
|
||||
export type GetAllToolsHandler = () => ToolInfo[];
|
||||
|
||||
export type SetActiveToolsHandler = (toolNames: string[]) => void;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user