Skip to main content

Function: withNotes()

withNotes<T>(__namedParameters): ResultWithNotes<T>

Defined in: tool.ts:310

Wraps a defineTool method's data with notes: each non-empty note becomes its own text block after the data's JSON. structuredContent stays the data alone, so an outputSchema describes the data, never the notes.

Type Parameters​

Type Parameter
T

Parameters​

ParameterType
__namedParameters{ data: T; notes: string[]; }
__namedParameters.dataT
__namedParameters.notesstring[]

Returns​

ResultWithNotes<T>

Example​

method: async (args) => {
const report = await buildReport(args);
return withNotes({
data: report,
notes: report.partial ? ['Only the last 7 days are available.'] : [],
});
},