mira-app-server
Version:
Mira Server - standalone server application using mira-app-core
31 lines • 848 B
TypeScript
/**
* MCP 工具结果构造辅助函数
*
* 工具 handler 返回 CallToolResult:成功把数据 JSON 化为 text;失败标记 isError。
*/
/** 成功结果:把任意可序列化数据 JSON 化 */
export declare function ok(data: unknown): {
content: {
type: "text";
text: string;
}[];
};
/** 错误结果 */
export declare function err(message: string): {
isError: boolean;
content: {
type: "text";
text: string;
}[];
};
/**
* 包装一个异步工具体:自动 try/catch,把 Error.message 转成 isError 结果。
* 同时把 SDK 抛出的 ErrorResponse(含 message 字段)也正确提取。
*/
export declare function run(fn: () => Promise<unknown>): Promise<{
content: {
type: "text";
text: string;
}[];
}>;
//# sourceMappingURL=helpers.d.ts.map