UNPKG

rework-mcp-server

Version:

Rework MCP Server - Integrate rework tasks with AI through Model Context Protocol

39 lines (38 loc) 1.22 kB
class Responder { /** * Creates a response with optional sponsorship message */ static createResponse(data, includeSponsorMessage = false) { const content = []; // Special handling for workspace hierarchy which contains a preformatted tree if (data && typeof data === 'object' && 'hierarchy' in data && typeof data.hierarchy === 'string') { // Handle workspace hierarchy specially - it contains a preformatted tree content.push({ type: "text", text: data.hierarchy }); } else if (typeof data === 'string') { // If it's already a string, use it directly content.push({ type: "text", text: data }); } else { // Otherwise, stringify the JSON object content.push({ type: "text", text: JSON.stringify(data, null, 2) }); } return { content }; } static clearUnusedFields(data) { delete data.hid; delete data.collector; delete data.type; delete data.token; } } export default Responder;