Skip to content

Commit 3de956d

Browse files
committed
cli
1 parent 6bc1049 commit 3de956d

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/cli.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ export const cliOptions = {
157157
describe: 'Whether to enable vision tools',
158158
hidden: true,
159159
},
160+
experimentalStructuredContent: {
161+
type: 'boolean',
162+
describe: 'Whether to output structured formatted content.',
163+
hidden: true,
164+
},
160165
experimentalIncludeAllPages: {
161166
type: 'boolean',
162167
describe:

src/main.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,22 @@ function registerTool(tool: ToolDefinition): void {
153153
response,
154154
context,
155155
);
156-
const {content} = await response.handle(tool.name, context);
157-
return {
156+
const {content, structuredContent} = await response.handle(
157+
tool.name,
158+
context,
159+
);
160+
const result: CallToolResult & {
161+
structuredContent?: Record<string, unknown>;
162+
} = {
158163
content,
159164
};
165+
if (args.experimentalStructuredContent) {
166+
result.structuredContent = structuredContent as Record<
167+
string,
168+
unknown
169+
>;
170+
}
171+
return result;
160172
} catch (err) {
161173
logger(`${tool.name} error:`, err, err?.stack);
162174
let errorText = err && 'message' in err ? err.message : String(err);

0 commit comments

Comments
 (0)