diff --git a/packages/core/src/tool/plugin/webfetch.ts b/packages/core/src/tool/plugin/webfetch.ts index 644651ec2d1d..39543dd19dd0 100644 --- a/packages/core/src/tool/plugin/webfetch.ts +++ b/packages/core/src/tool/plugin/webfetch.ts @@ -35,9 +35,7 @@ export const Input = Schema.Struct({ }) const Output = Schema.Struct({ - url: Schema.String, contentType: Schema.String, - format: Input.fields.format, output: Schema.String, }) type Format = (typeof Input.Type)["format"] @@ -195,13 +193,7 @@ export const Plugin = { try: () => convert(content, contentType, input.format), catch: (error) => error, }) - const result = { - url: input.url, - contentType, - format: input.format, - output, - } - return { output: result, content: result.output, metadata: { contentType: result.contentType } } + return { output: { contentType, output }, content: output, metadata: { contentType } } }).pipe(Effect.mapError((error) => new ToolFailure({ message: `Unable to fetch ${input.url}`, error }))), }) }) diff --git a/packages/core/test/tool-webfetch.test.ts b/packages/core/test/tool-webfetch.test.ts index 5c37b5a010f4..1cef438e830d 100644 --- a/packages/core/test/tool-webfetch.test.ts +++ b/packages/core/test/tool-webfetch.test.ts @@ -433,7 +433,7 @@ describe("WebFetchTool registration", () => { expect((yield* toolDefinitions(registry)).map((tool) => tool.name)).toEqual(["webfetch", "execute"]) expect(yield* executeTool(registry, call({ url, format: "text", timeout: 4 }))).toEqual({ status: "completed", - output: { url, contentType: "text/plain", format: "text", output: "hello" }, + output: { contentType: "text/plain", output: "hello" }, content: [{ type: "text", text: "hello" }], metadata: { contentType: "text/plain" }, })