1. Ask Pear which mail folders exist
Strands can invoke a named MCP tool directly. This example reads the folders on your default mail account without passing them to a model. The context manager closes the connection when the call finishes.
import os
from uuid import uuid4
from strands.tools.mcp import MCPClient
pear = MCPClient(
url="https://pearmcp.com/api/mcp",
headers={"Authorization": f"Bearer {os.environ['PEAR_API_KEY']}"},
)
with pear:
result = pear.call_tool_sync(
tool_use_id=str(uuid4()),
name="pear_list_mail_folders",
arguments={},
)
if result["status"] != "success":
raise RuntimeError("Folder lookup failed. Check the account and key.")
print(result["content"])Example requestWhich exact folder path does Pear return for the project folder I use in Mail or Outlook?
What to check
Compare a custom folder name and its parent with your mailbox app. Keep the returned provider identifiers alongside the display names.
2. Choose a folder for a later search
If your Strands application also has a model, give its mail search only the read tools it needs. Use the discovered folder and bound the first search to one familiar message. The Python check above ends after listing folders.
Example requestSearch the selected project folder for the subject I give you. Return up to three matches with sender and date. Leave the messages as they are.
What to check
Open one match in the same folder and compare its sender and date. A similarly named folder in another account can contain different mail.
If the result is not what you expected
Strands rejects the url argument
Check the installed strands-agents version against the transport reference. The example uses the documented MCPClient constructor with url and headers.
Pear asks you to choose an account
Call pear_provider_status to identify the connected mailbox, then use the account selector from the live folder tool schema. A send-only connection cannot enumerate folders.
Know what you are connecting
The Strands SDK documents the transport and direct tool call. A live Pear account test with Strands is pending. Folder names can contain client or project information. Keep terminal output private and revoke the project key in Pear when finished.
Read how Pear handles your data
