UNPKG

@turbot/tailpipe-mcp

Version:

Tailpipe MCP server to query cloud and security logs using AI.

44 lines 1.36 kB
/** * Centralized function for stringifying MCP responses without indentation * @param data The data to stringify * @returns Stringified data without indentation */ export function stringifyResponse(data) { return JSON.stringify(data); } export function validateAndFormat(output, cmd, resourceType) { // Just validate it's valid JSON const details = JSON.parse(output); return { content: [{ type: "text", text: stringifyResponse({ [resourceType]: details, debug: { command: cmd } }) }] }; } /** * Formats a list result with debug information in a consistent way * @param data The data to format (e.g. plugins, tables, partitions) * @param key The key to use in the response object (e.g. "plugins", "tables", "partitions") * @param cmd The command that was executed * @returns A formatted tool response */ export function formatListResult(data, key, cmd) { return Promise.resolve({ content: [{ type: "text", text: stringifyResponse({ [key]: data, debug: { command: cmd } }) }] }); } //# sourceMappingURL=format.js.map