INNER CODE UNIT · JavaScript

formatContentExtractionResult

aeonfun/opendia · opendia-mcp/server.js:553

function formatContentExtractionResult(result, metadata) {
  // summarize:true (the default) reports extraction_method; summarize:false reports method.
  const method = result.method || result.extraction_method;
  const contentSummary = `Extracted ${result.content_type} content using ${method}:\n\n`;
  if (result.content) {
    // Check if this is full content extraction (summarize=false) or summary
    // If it's a content object with properties, show full content
    // If it's a string or small content, it's probably summarized
    let preview;
    if (typeof result.content === "string") {
      // String content - likely summarized, keep truncation
      preview = result.content.substring(0, 500) + (result.content.length > 500 ? "..." : "");
    } else if (result.content && typeof result.content === "object") {
      // Object content - check if it's full content extraction
      if (result.content.content && result.content.content.length > 1000) {
        // This looks like full content extraction - don't truncate
        preview = JSON.stringify(result.content, null, 2);
      } else {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…