SharePoint Online
Give agents tools to search sites and files, manage lists, list items, and site pages, and share drive items in SharePoint Online through Mastra Connect. Each tool call goes through the Mastra platform, which adds the connection's credential. Your application never stores SharePoint Online credentials.
ConnectDirect link to Connect
Before you start, complete the Connect setup to install @mastra/connect and configure your platform project.
Connect an accountDirect link to Connect an account
Run this command from the directory that contains your .env file:
mastra connect add sharepoint-online
The CLI guides you through SharePoint Online's authorization and waits until the connection is active.
Add tools to an agentDirect link to Add tools to an agent
Pass tools() to the agent and select the sharepoint-online provider:
import { Agent } from '@mastra/core/agent'
import { tools } from '@mastra/connect'
export const sharepointOnlineAgent = new Agent({
id: 'sharepoint-online-agent',
name: 'SharePoint Online agent',
instructions:
'You help people search sites and files, manage lists, list items, and site pages, and share drive items in SharePoint Online.',
model: 'openai/gpt-6-luna',
tools: tools({ providers: ['sharepoint-online'] }),
})
The agent gets 53 SharePoint Online tools, with keys such as sharepoint_online_add_content_type_to_list. See SharePoint Online tools for the full list, and the tools() parameters to restrict tools or require approval before a call runs.