Skip to content

Raw bytes support sending to mcp server in callTool method #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghalibansari opened this issue May 22, 2025 · 0 comments
Open

Raw bytes support sending to mcp server in callTool method #539

ghalibansari opened this issue May 22, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@ghalibansari
Copy link

Describe the bug
Unable to send ray bytes / ArrayBuffer / Buffer to mcp server, pydantic validation failes

To Reproduce
Steps to reproduce the behavior:

  1. read file from html as buffer send it to client and use callTool method to upload file and it fails

Expected behavior

  1. read file from from user in html, using FileReader [ readAsDataURL, readAsArrayBuffer]
  2. solution 1 troed : readAsDataURL covert to base64 then Buffer.from(data, 'base64') send to mcp server fails
  3. solution 2 tried : readAsDataURL covert to base64 then Buffer.from(data, 'base64') then bytes = new Uint8Array(tmp.buffer, tmp.byteOffset, tmp.byteLength) still fails.
  4. readAsArrayBuffer sending this directly still fails and tried few more soultion none worked.

Logs
{
type: "text",
text: 'Error executing tool upload_file_and_email: 1 validation error for upload_file_and_emailArguments files..env\ Input should be a valid bytes [type=bytes_type, input_value={'0': 65, '1': 90, '2': 8....., '333': 109, '334': 34}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/bytes_type`,
}

Additional context

  1. at last modified server to hanle base64 directly instead of bytes.
  2. i think it call_tool method convert it to stre
@ghalibansari ghalibansari added the bug Something isn't working label May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant