mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Tool result refactor (return an object instead of a string)
This commit is contained in:
40 files changed
+315
-276
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { Tool } from "./Tool";
|
||||
import type { Tool, ToolResult } from "./Tool";
|
||||
import { NostrbookClient } from "../NostrbookClient";
|
||||
|
||||
interface NostrReadProtocolParams {
|
||||
@@ -22,12 +22,12 @@ export class NostrReadProtocolTool implements Tool<NostrReadProtocolParams> {
|
||||
});
|
||||
}
|
||||
|
||||
async execute(args: NostrReadProtocolParams): Promise<string> {
|
||||
async execute(args: NostrReadProtocolParams): Promise<ToolResult> {
|
||||
const { doc } = args;
|
||||
|
||||
try {
|
||||
const text = await this.nostrbookClient.readProtocol(doc);
|
||||
return text;
|
||||
return { content: text };
|
||||
} catch (error) {
|
||||
throw new Error(`Error reading protocol doc "${doc}": ${error instanceof Error ? error.message : 'Unknown error'}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user