Skip to content

Commit d0b98f4

Browse files
committed
Add stringify option default for legacy user
1 parent f8998cd commit d0b98f4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tools/BaseTool.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export abstract class MCPTool<TInput extends Record<string, any> = {}>
5151
abstract name: string;
5252
abstract description: string;
5353
protected abstract schema: ToolInputSchema<TInput>;
54+
protected useStringify: boolean = true;
5455
[key: string]: unknown;
5556

5657
get inputSchema(): { type: "object"; properties?: Record<string, unknown> } {
@@ -127,7 +128,10 @@ export abstract class MCPTool<TInput extends Record<string, any> = {}>
127128
}
128129

129130
return {
130-
content: [{ type: "text", text: String(data) }],
131+
content: [{
132+
type: "text",
133+
text: this.useStringify ? JSON.stringify(data) : String(data)
134+
}],
131135
};
132136
}
133137

0 commit comments

Comments
 (0)