File Transfer
Invocation
Use the exact tool name and parameter schema exposed by the current harness. Tool names in SDK examples below are raw MCP names, not model-facing aliases. Local files must be uploaded with molclaw-file-transfer before a server tool can use them. Repair PDB inputs first when the workflow requires it.
When the client-exposed schema includes local_file_path, prefer this client-side form for files already present in the current local workspace. For upload, call base64_to_server_file with file_name and local_file_path and omit file_base64_string. For download, call server_file_to_base64 with the server's file_path and a new, unique filename in local_file_path; a successful result returns its absolute local path. Reuse that returned path for later local operations or uploads. An absolute path inside the allowed workspace is also accepted; use it for a file created by a local tool. Do not copy file bytes through the model output. The client validates the path and performs the encoding or decoding; the MCP server still uses its original Base64 interface. If the exposed schema lacks local_file_path, use the original Base64 form below. Do not supply both upload forms in one call.
The Python examples below call the public SCP service directly and demonstrate its original Base64 interface. They do not show the client-side path extension.
1. Transfer local file to SCP server
Example code:
pythonimport base64 client = DrugSDAClient("https://scp.intern-ai.org.cn/api/v1/mcp/2/DrugSDA-Tool") if not await client.connect(): print("connection failed") return ## Convert local file to base64 string local_file = "/path/a.txt" #Input local file path with open(local_file, "rb") as f: file_content = f.read() file_base64_string = base64.b64encode(file_content).decode('utf-8') ## Call tool base64_to_server_file to save base64 string as server file response = await client.session.call_tool( "base64_to_server_file", arguments={ "file_name": "a.txt", "file_base64_string": file_base64_string } ) result = client.parse_result(response) save_file = result["save_file"] #Server file path after transfer await client.disconnect()
2. Transfer SCP server file to local
Example code:
pythonimport base64 client = DrugSDAClient("https://scp.intern-ai.org.cn/api/v1/mcp/2/DrugSDA-Tool") if not await client.connect(): print("connection failed") return ## Call tool server_file_to_base64 to convert server file to base64 string response = await client.session.call_tool( "server_file_to_base64", arguments={ "file_path": "/path/a.txt" #Input server file path } ) result = client.parse_result(response) base64_string = result["base64_string"] file_name = result["file_name"] ## Convert base64 string to local file file_data = base64.b64decode(base64_string) local_file_path = "/path/" + file_name with open(local_file_path, "wb") as f: f.write(file_data) await client.disconnect()


