/**
* Response formatting utilities for MCP tools
*/
/**
* Create a successful tool response
*/
export function createToolSuccessResponse(data: any) {
return {
content: [
{
type: "text" as const,
text: JSON.stringify(data, null, 2),
},
],
};
}
/**
* Create an error tool response
*/
export function createToolErrorResponse(message: string, code?: string) {
const errorData: any = {
error: message,
};
if (code) {
errorData.code = code;
}
return {
content: [
{
type: "text" as const,
text: JSON.stringify(errorData, null, 2),
},
],
isError: true,
};
}