Skip to main content

Outlook: Search Tool

Usage

All Portia tools using API endpoints that require OAuth are built with plug and play authentication support. They use Portia client credentials including client ID, client name and redirect URL. Such tools will raise a Action Clarification with an OAuth link as the action URL. The portia.wait_for_ready() method must be used in this scenario: Portia's OAuth server will listen for the authentication result and resolve the concerned clarification, allowing your plan run to resume again.

For more on this, please visit to the section on running Portia tools ().

Selecting Microsoft Tools

Microsoft tools are included in Portia's cloud registry but are not included in the default DefaultToolRegistry class. This is due to tool clashes with the Google tools (i.e. the agent wouldn't know whether to check Gmail or Outlook for email tasks). In order to use Microsoft tools rather than Google tools, simply filter out the Google tools from the Portia cloud registry rather than using the default registry:

from portia import PortiaToolRegistry, default_config

registry = PortiaToolRegistry(default_config()).filter_tools(lambda tool: not tool.id.startswith("portia:google:"))registry = PortiaToolRegistry(default_config()).filter_tools(
lambda tool: not tool.id.startswith("portia:google:")
)

Tool details

Tool ID: portia:microsoft:outlook:search_email

Tool description: Searches for emails in the user's Outlook inbox and returns emails content that match the query.

Args schema:

{
"description": "Input for SearchEmailTool.",
"properties": {
"query": {
"description": "The query to search for emails. This supports basic search terms and can include filters like 'from:', 'subject:', etc.",
"title": "Query",
"type": "string"
}
},
"required": [
"query"
],
"title": "SearchEmailToolSchema",
"type": "object"
}

Output schema:

('list[dict[str, str]]', 'list[dict[str, str]]: List of emails with the following keys: from, to, subject, date, body.')