Skip to content

Conversation

naaa760
Copy link

@naaa760 naaa760 commented Oct 5, 2025

PR Description

  • automatically filters out images, videos, audio, and other media content from MCP server message attributes to prevent large media from breaking instrumentation. Tracks dropped media via client reports.

fixes: #17810

Changes:

  • Added media detection logic for common file types (images, videos, audio, documents)
  • Filters media content from tool results and prompt results before attribute extraction
  • Integrates with existing client reports system to track dropped media
  • Preserves all text content while removing only media items

@RulaKhaled RulaKhaled self-requested a review October 6, 2025 08:38
@naaa760
Copy link
Author

naaa760 commented Oct 7, 2025

@RulaKhaled
let me know, resolve it

const content = message.content;
if (typeof content.text === 'string') {
const attrName = messages.length === 1 ? `${prefix}.message_content` : `${prefix}.content`;
const attrName = filteredMessages.length === 1 ? `${prefix}.message_content` : `${prefix}.content`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Undefined Variable Causes Reference Error

A ReferenceError occurs because filteredMessages.length is referenced but filteredMessages is not defined in this scope. It looks like messages.length was the intended variable.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop Media from messages in SDKs and document behavior
1 participant