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:
Mario Zechner 2026-01-12 17:16:36 +01:00
parent 34ecca352e
commit 1367a76ee8
12 changed files with 34 additions and 19 deletions

View file

@ -99,6 +99,7 @@ export type {
ToolCallEventResult,
// Tools
ToolDefinition,
ToolInfo,
ToolRenderResultOptions,
ToolResultEvent,
ToolResultEventResult,

View file

@ -187,7 +187,7 @@ function createExtensionAPI(
return runtime.getActiveTools();
},
getAllTools(): string[] {
getAllTools() {
return runtime.getAllTools();
},

View file

@ -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;