first commit
This commit is contained in:
24
app/chrome-extension/common/tool-handler.ts
Normal file
24
app/chrome-extension/common/tool-handler.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { CallToolResult, TextContent, ImageContent } from '@modelcontextprotocol/sdk/types.js';
|
||||
|
||||
export interface ToolResult extends CallToolResult {
|
||||
content: (TextContent | ImageContent)[];
|
||||
isError: boolean;
|
||||
}
|
||||
|
||||
export interface ToolExecutor {
|
||||
execute(args: any): Promise<ToolResult>;
|
||||
}
|
||||
|
||||
export const createErrorResponse = (
|
||||
message: string = 'Unknown error, please try again',
|
||||
): ToolResult => {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: message,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user