Skip to main content
Glama

share_file

Transfer file content between Claude AI instances using Inter-Process Communication to enable collaborative workflows and data sharing.

Instructions

Share file content with another instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_idYesYour instance ID
to_idYesTarget instance ID
filepathYesPath to file to share
descriptionNoDescription of the file

Implementation Reference

  • Handler for the 'share_file' tool. Reads the content of the specified file and sends it to the target instance via the IPC broker's 'send' action, including file metadata in the message data.
    elif name == "share_file":
        if not current_session_token:
            return [TextContent(type="text", text="Error: Not registered. Please register first.")]
            
        try:
            with open(arguments["filepath"], 'r') as f:
                content = f.read()
                
            message = {
                "content": f"Shared file: {arguments['filepath']}",
                "data": {
                    "type": "file",
                    "filepath": arguments["filepath"],
                    "content": content,
                    "description": arguments.get("description", "")
                }
            }
            
            response = BrokerClient.send_request({
                "action": "send",
                "from_id": arguments["from_id"],
                "to_id": arguments["to_id"],
                "message": message,
                "session_token": current_session_token
            })
            return [TextContent(type="text", text=f"File shared: {json.dumps(response, indent=2)}")]
                
        except Exception as e:
            return [TextContent(type="text", text=f"Error sharing file: {e}")]
  • Registration of the 'share_file' tool in the MCP server's list_tools() function, including name, description, and input schema.
        name="share_file",
        description="Share file content with another instance",
        inputSchema={
            "type": "object",
            "properties": {
                "from_id": {
                    "type": "string",
                    "description": "Your instance ID"
                },
                "to_id": {
                    "type": "string",
                    "description": "Target instance ID"
                },
                "filepath": {
                    "type": "string",
                    "description": "Path to file to share"
                },
                "description": {
                    "type": "string",
                    "description": "Description of the file"
                }
            },
            "required": ["from_id", "to_id", "filepath"]
        }
    ),
  • Input schema definition for the 'share_file' tool, specifying parameters: from_id, to_id, filepath (required), and optional description.
    inputSchema={
        "type": "object",
        "properties": {
            "from_id": {
                "type": "string",
                "description": "Your instance ID"
            },
            "to_id": {
                "type": "string",
                "description": "Target instance ID"
            },
            "filepath": {
                "type": "string",
                "description": "Path to file to share"
            },
            "description": {
                "type": "string",
                "description": "Description of the file"
            }
        },
        "required": ["from_id", "to_id", "filepath"]
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jdez427/claude-ipc-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server