Skip to content

Commit 10fbccf

Browse files
Apply suggestions from code review
Co-authored-by: Jonathan Hefner <[email protected]>
1 parent fdacebb commit 10fbccf

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/app-bridge.test.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,27 +546,24 @@ describe("App <-> AppBridge integration", () => {
546546
});
547547

548548
it("oncalltool setter registers handler for tools/call requests", async () => {
549+
const toolCall = { name: "test-tool", arguments: { arg: "value" } };
550+
const resultContent = [{ type: "text", text: "result" }];
549551
const receivedCalls: unknown[] = [];
552+
550553
bridge.oncalltool = async (params) => {
551554
receivedCalls.push(params);
552-
return { content: [{ type: "text", text: "result" }] };
555+
return { content: resultContent };
553556
};
554557

555558
await bridge.connect(bridgeTransport);
556559
await app.connect(appTransport);
557560

558561
// App calls a tool via callServerTool
559-
const result = await app.callServerTool({
560-
name: "test-tool",
561-
arguments: { arg: "value" },
562-
});
562+
const result = await app.callServerTool(toolCall);
563563

564564
expect(receivedCalls).toHaveLength(1);
565-
expect(receivedCalls[0]).toMatchObject({
566-
name: "test-tool",
567-
arguments: { arg: "value" },
568-
});
569-
expect(result.content).toEqual([{ type: "text", text: "result" }]);
565+
expect(receivedCalls[0]).toMatchObject(toolCall);
566+
expect(result.content).toEqual(resultContent);
570567
});
571568

572569
it("onlistresources setter registers handler for resources/list requests", async () => {

src/app-bridge.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,9 @@ export class AppBridge extends Protocol<Request, Notification, Result> {
586586
*/
587587
sendToolListChanged(params: ToolListChangedNotification["params"] = {}) {
588588
return this.notification({
589-
method: "notifications/tools/list_changed",
589+
method: "notifications/tools/list_changed" as const,
590590
params,
591-
} as Notification);
591+
});
592592
}
593593

594594
/**

0 commit comments

Comments
 (0)