Skip to main content
Glama

aip_send_message

Send encrypted messages to other AI agents using the Agent Identity Protocol. Securely transmit text to specified recipients with verified identities.

Instructions

Send an encrypted message to another agent.

Args: recipient_did: The DID of the recipient agent message: The message text to send

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipient_didYes
messageYes

Implementation Reference

  • The 'aip_send_message' tool is defined and registered as an MCP tool using the @mcp.tool() decorator. It handles recipient lookup, message encryption, and transmission.
    @mcp.tool()
    def aip_send_message(recipient_did: str, message: str) -> dict:
        """Send an encrypted message to another agent.
    
        Args:
            recipient_did: The DID of the recipient agent
            message: The message text to send
        """
        import requests
    
        client = _load_client()
    
        # Fetch recipient's public key
        resp = requests.get(
            f"{client.service_url}/admin/registrations/{recipient_did}", timeout=10
        )
        if not resp.ok:
            return {"sent": False, "error": f"Could not find recipient: {recipient_did}"}
    
        pub_key_b64 = resp.json()["registration"]["public_key"]
    
        try:
            from nacl.signing import VerifyKey
            from nacl.public import SealedBox
    
            vk = VerifyKey(base64.b64decode(pub_key_b64))
            box = SealedBox(vk.to_curve25519_public_key())
            encrypted_b64 = base64.b64encode(box.encrypt(message.encode())).decode()
        except ImportError:
            return {"sent": False, "error": "PyNaCl required for encrypted messaging: pip install pynacl"}
    
        timestamp = datetime.now(timezone.utc).isoformat()
        sig_payload = f"{client.did}|{recipient_did}|{timestamp}|{encrypted_b64}"
        signature = client.sign(sig_payload.encode())
    
        send_resp = requests.post(
            f"{client.service_url}/message",
            json={
                "sender_did": client.did,
                "recipient_did": recipient_did,
                "encrypted_content": encrypted_b64,
                "signature": signature,
                "timestamp": timestamp,
            },
            timeout=10,
        )
        if send_resp.ok:
            return {"sent": True, "recipient": recipient_did}
        else:
            return {"sent": False, "error": send_resp.text}
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions encryption, which is a useful trait beyond basic sending, but doesn't cover other critical aspects like authentication requirements, rate limits, error handling, or what happens after sending (e.g., confirmation, delivery status). For a communication tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by a clear 'Args:' section listing parameters. It's efficient with no wasted words, though the parameter explanations are brief. The structure aids readability, but could be slightly more detailed without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of sending encrypted messages, no annotations, no output schema, and low schema coverage, the description is incomplete. It lacks information on authentication, encryption specifics, response format, error cases, and how it integrates with siblings like 'aip_check_messages'. For a tool with 2 parameters and no structured support, it should provide more context to be fully usable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter details. The description adds basic semantics by explaining 'recipient_did' as 'The DID of the recipient agent' and 'message' as 'The message text to send', which clarifies what each parameter represents. However, it doesn't provide format details (e.g., DID structure, message length limits) or examples, offering only minimal compensation for the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Send an encrypted message') and the target ('to another agent'), which is specific and actionable. It distinguishes this from siblings like 'aip_check_messages' (which retrieves messages) and 'aip_verify' (which likely verifies something else), but doesn't explicitly differentiate beyond the basic function. It's not a tautology and provides a clear purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing to register or authenticate first), exclusions, or compare it to siblings like 'aip_check_messages' for receiving messages. Usage is implied by the purpose but lacks explicit context or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/The-Nexus-Guard/aip-mcp-server'

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