Skip to content

API Reference parrot_tools.msteams

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.msteams

View source

MS Teams Toolkit - A unified toolkit for Microsoft Teams operations.

This toolkit wraps common MS Teams actions as async tools, extending AbstractToolkit. It supports authentication via Azure AD (service principal or delegated user).

Notes:

  • All public async methods become tools via AbstractToolkit
  • Supports both application permissions and delegated user permissions
  • Adaptive cards can be sent as strings, dicts, or created via create_adaptive_card

Alias AbstractToolkit

Re-exported from parrot_tools.toolkit.AbstractToolkit.

Class ChatMessagesFromUserInput

Input schema for extracting messages from a specific user in a chat.

Fields:

Field Type Default Description
chat_id str The Chat ID
user_email str Email of the user whose messages to extract
start_time Optional[str] None Start time for message filter (ISO format)
end_time Optional[str] None End time for message filter (ISO format)
max_messages Optional[int] 50 Maximum number of messages to retrieve

Class CreateAdaptiveCardInput

Input schema for creating an Adaptive Card.

Fields:

Field Type Default Description
title str Card title
body_text str Main body text of the card
image_url Optional[str] None Optional image URL to include in the card
link_url Optional[str] None Optional link URL
link_text Optional[str] 'Learn more' Text for the link button
facts Optional[List[Dict[str, str]]] None Optional list of facts, each with 'title' and 'value' keys

Class CreateChatInput

Input schema for creating a one-on-one chat.

Fields:

Field Type Default Description
recipient_email str Email address of the user to create chat with

Class ExtractChannelMessagesInput

Input schema for extracting channel messages.

Fields:

Field Type Default Description
team_id str The Team ID
channel_id str The Channel ID
start_time Optional[str] None Start time for message filter (ISO format, e.g., '2025-01-01T00:00:00Z')
end_time Optional[str] None End time for message filter (ISO format, e.g., '2025-01-31T23:59:59Z')
max_messages Optional[int] None Maximum number of messages to retrieve

Class FindChannelByNameInput

Input schema for finding a channel by name within a team.

Fields:

Field Type Default Description
team_id str The Team ID to search in
channel_name str Name of the channel to search for

Class FindChatByNameInput

Input schema for finding a chat by name/topic.

Fields:

Field Type Default Description
chat_name str Name or topic of the chat to search for

Class FindOneOnOneChatInput

Input schema for finding a one-on-one chat between two users.

Fields:

Field Type Default Description
user1_email str Email of the first user
user2_email str Email of the second user

Class FindTeamByNameInput

Input schema for finding a team by name.

Fields:

Field Type Default Description
team_name str Name of the team to search for

Class GetChannelDetailsInput

Input schema for getting channel details.

Fields:

Field Type Default Description
team_id str The Team ID
channel_id str The Channel ID

Class GetChannelMembersInput

Input schema for getting channel members.

Fields:

Field Type Default Description
team_id str The Team ID
channel_id str The Channel ID

Class GetChatMessagesInput

Input schema for getting messages from a chat.

Fields:

Field Type Default Description
chat_id str The Chat ID
start_time Optional[str] None Start time for message filter (ISO format)
end_time Optional[str] None End time for message filter (ISO format)
max_messages Optional[int] 50 Maximum number of messages to retrieve

Class GetMeetingTranscriptInput

Input schema for downloading a meeting transcript.

Fields:

Field Type Default Description
user_id str The user ID (GUID) or user principal name (email) who owns the meeting
online_meeting_id str The online meeting ID
transcript_id str The transcript ID to download
format Optional[str] 'text/vtt' The format for the transcript content: 'text/vtt' (WebVTT with timestamps) or 'text/plain' (plain text)

Class GetOnlineMeetingIdInput

Input schema for getting online meeting ID from a calendar event by subject.

Fields:

Field Type Default Description
user_id str The user ID (GUID) or user principal name (email) to search calendar events for
subject str The subject of the meeting to search for (uses startsWith filter)
start_time Optional[str] None Start time to filter events (ISO format, e.g., '2025-01-01T00:00:00Z')
end_time Optional[str] None End time to filter events (ISO format, e.g., '2025-01-31T23:59:59Z')

Class GetUserInput

Input schema for getting user information.

Fields:

Field Type Default Description
email str Email address of the user to look up

Class ListMeetingTranscriptsInput

Input schema for listing meeting transcripts.

Fields:

Field Type Default Description
user_id str The user ID (GUID) or user principal name (email) who owns the meeting
online_meeting_id str The online meeting ID to list transcripts for

Class ListUserChatsInput

Input schema for listing user chats.

Fields:

Field Type Default Description
max_chats Optional[int] 50 Maximum number of chats to retrieve

Class MSTeamsToolkit

Toolkit for interacting with Microsoft Teams via Microsoft Graph API.

Provides methods for:

  • Sending messages to channels
  • Sending messages to chats
  • Sending direct messages to users
  • Creating adaptive cards
  • Managing chats and users
  • Finding teams and channels by name
  • Extracting messages from channels and chats
  • Getting online meeting IDs from calendar events
  • Listing and downloading meeting transcripts All public async methods are exposed as tools via AbstractToolkit.
Parameter Type Default Description
tenant_id Optional[str] None Azure AD tenant ID
client_id Optional[str] None Azure AD application client ID
client_secret Optional[str] None Azure AD application client secret (for app-only auth)
as_user bool False If True, use delegated user permissions instead of application
username Optional[str] None Username for delegated auth (required if as_user=True)
password Optional[str] None Password for delegated auth (required if as_user=True)
**kwargs {} Additional toolkit arguments

Method MSTeamsToolkit.send_message_to_channel

Send a message or Adaptive Card to a public Teams channel.

Can use either:

  1. Webhook URL (recommended for application permissions) - works without Graph API
  2. Team ID + Channel ID (requires delegated user permissions)

send_message_to_channel(team_id: Optional[str] = None, channel_id: Optional[str] = None, webhook_url: Optional[str] = None, message: Union[str, Dict[str, Any]] = None) -> Dict[str, Any]

Parameter Type Default Description
team_id Optional[str] None The Team ID where the channel exists (not needed if webhook_url is provided)
channel_id Optional[str] None The Channel ID to post the message to (not needed if webhook_url is provided)
webhook_url Optional[str] None Incoming webhook URL for the channel (alternative to team_id/channel_id)
message Union[str, Dict[str, Any]] None Message content - can be: - Plain text string - Adaptive Card JSON string - Dict with 'body' and 'attachments' keys

Returns: Dict[str, Any] — Dict containing the sent message information

Method MSTeamsToolkit.send_message_to_chat

Send a message or Adaptive Card to a private chat (one-to-one or group chat).

send_message_to_chat(chat_id: str, message: Union[str, Dict[str, Any]]) -> Dict[str, Any]

Parameter Type Default Description
chat_id str The Chat ID to send the message to
message Union[str, Dict[str, Any]] Message content - can be: - Plain text string - Adaptive Card JSON string - Dict with 'body' and 'attachments' keys

Returns: Dict[str, Any] — Dict containing the sent message information

Method MSTeamsToolkit.send_direct_message

Send a direct message or Adaptive Card to a user identified by email address.

This method will:

  1. Look up the user by email
  2. Find or create a one-on-one chat with the user
  3. Send the message to that chat

send_direct_message(recipient_email: str, message: Union[str, Dict[str, Any]]) -> Dict[str, Any]

Parameter Type Default Description
recipient_email str Email address of the recipient user
message Union[str, Dict[str, Any]] Message content - can be: - Plain text string - Adaptive Card JSON string - Dict with 'body' and 'attachments' keys

Returns: Dict[str, Any] — Dict containing the sent message information

Method MSTeamsToolkit.create_adaptive_card

Create a basic Adaptive Card that can be used in Teams messages.

create_adaptive_card(title: str, body_text: str, image_url: Optional[str] = None, link_url: Optional[str] = None, link_text: str = 'Learn more', facts: Optional[List[Dict[str, str]]] = None) -> Dict[str, Any]

Parameter Type Default Description
title str Card title
body_text str Main body text of the card
image_url Optional[str] None Optional image URL to include in the card
link_url Optional[str] None Optional link URL for a button
link_text str 'Learn more' Text for the link button (default: "Learn more")
facts Optional[List[Dict[str, str]]] None Optional list of facts, each with 'title' and 'value' keys

Returns: Dict[str, Any] — Dict representing an Adaptive Card that can be passed to send methods

Method MSTeamsToolkit.get_user

Get user information from Microsoft Graph by email address.

get_user(email: str) -> Dict[str, Any]

Parameter Type Default Description
email str Email address of the user to look up

Returns: Dict[str, Any] — Dict containing user information (id, displayName, mail, etc.)

Method MSTeamsToolkit.create_one_on_one_chat

Create a new one-on-one chat with a user (or return existing chat ID).

create_one_on_one_chat(recipient_email: str) -> Dict[str, Any]

Parameter Type Default Description
recipient_email str Email address of the user to chat with

Returns: Dict[str, Any] — Dict containing chat information

Method MSTeamsToolkit.find_team_by_name

Find a team by its name and return the team information including ID.

find_team_by_name(team_name: str) -> Optional[Dict[str, Any]]

Parameter Type Default Description
team_name str Name of the team to search for

Returns: Optional[Dict[str, Any]] — Dict containing team information (id, displayName, description) or None if not found

Method MSTeamsToolkit.find_channel_by_name

Find a channel by name within a specific team.

find_channel_by_name(team_id: str, channel_name: str) -> Optional[Dict[str, Any]]

Parameter Type Default Description
team_id str The Team ID to search in
channel_name str Name of the channel to search for

Returns: Optional[Dict[str, Any]] — Dict containing channel information (id, displayName, description) or None if not found

Method MSTeamsToolkit.get_channel_details

Get detailed information about a specific channel.

get_channel_details(team_id: str, channel_id: str) -> Dict[str, Any]

Parameter Type Default Description
team_id str The Team ID
channel_id str The Channel ID

Returns: Dict[str, Any] — Dict containing detailed channel information

Method MSTeamsToolkit.get_channel_members

Get all members of a specific channel.

get_channel_members(team_id: str, channel_id: str) -> List[Dict[str, Any]]

Parameter Type Default Description
team_id str The Team ID
channel_id str The Channel ID

Returns: List[Dict[str, Any]] — List of dicts containing member information

Method MSTeamsToolkit.extract_channel_messages

Extract messages from a channel within a time range.

extract_channel_messages(team_id: str, channel_id: str, start_time: Optional[str] = None, end_time: Optional[str] = None, max_messages: Optional[int] = None) -> List[Dict[str, Any]]

Parameter Type Default Description
team_id str The Team ID
channel_id str The Channel ID
start_time Optional[str] None Start time for message filter (ISO format, e.g., '2025-01-01T00:00:00Z')
end_time Optional[str] None End time for message filter (ISO format, e.g., '2025-01-31T23:59:59Z')
max_messages Optional[int] None Maximum number of messages to retrieve

Returns: List[Dict[str, Any]] — List of dicts containing message information

Method MSTeamsToolkit.list_user_chats

List all chats for the current user (requires delegated permissions).

list_user_chats(max_chats: int = 50) -> List[Dict[str, Any]]

Parameter Type Default Description
max_chats int 50 Maximum number of chats to retrieve (default: 50)

Returns: List[Dict[str, Any]] — List of dicts containing chat information

Method MSTeamsToolkit.find_chat_by_name

Find a chat by its name/topic (requires delegated permissions).

find_chat_by_name(chat_name: str) -> Optional[Dict[str, Any]]

Parameter Type Default Description
chat_name str Name or topic of the chat to search for

Returns: Optional[Dict[str, Any]] — Dict containing chat information or None if not found

Method MSTeamsToolkit.find_one_on_one_chat

Find a one-on-one chat between two users (requires delegated permissions).

find_one_on_one_chat(user1_email: str, user2_email: str) -> Optional[Dict[str, Any]]

Parameter Type Default Description
user1_email str Email of the first user
user2_email str Email of the second user

Returns: Optional[Dict[str, Any]] — Dict containing chat information or None if not found

Method MSTeamsToolkit.get_chat_messages

Get messages from a specific chat within a time range.

get_chat_messages(chat_id: str, start_time: Optional[str] = None, end_time: Optional[str] = None, max_messages: int = 50) -> List[Dict[str, Any]]

Parameter Type Default Description
chat_id str The Chat ID
start_time Optional[str] None Start time for message filter (ISO format)
end_time Optional[str] None End time for message filter (ISO format)
max_messages int 50 Maximum number of messages to retrieve (default: 50)

Returns: List[Dict[str, Any]] — List of dicts containing message information

Method MSTeamsToolkit.chat_messages_from_user

Extract all messages from a specific user in a chat within a time range.

chat_messages_from_user(chat_id: str, user_email: str, start_time: Optional[str] = None, end_time: Optional[str] = None, max_messages: int = 50) -> List[Dict[str, Any]]

Parameter Type Default Description
chat_id str The Chat ID
user_email str Email of the user whose messages to extract
start_time Optional[str] None Start time for message filter (ISO format)
end_time Optional[str] None End time for message filter (ISO format)
max_messages int 50 Maximum number of messages to retrieve (default: 50)

Returns: List[Dict[str, Any]] — List of dicts containing message information from the specified user

Method MSTeamsToolkit.get_online_meeting_id

Get the online meeting ID from a calendar event by subject.

This method follows a 3-step process:

  1. Find calendar events by subject (with optional time window)
  2. Extract the joinUrl from the event's onlineMeeting property
  3. Look up the onlineMeeting by joinWebUrl to get the onlineMeetingId

get_online_meeting_id(user_id: str, subject: str, start_time: Optional[str] = None, end_time: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
user_id str The user ID (GUID) or user principal name (email) to search calendar events for
subject str The subject of the meeting to search for (uses startsWith filter)
start_time Optional[str] None Start time to filter events (ISO format, e.g., '2025-01-01T00:00:00Z')
end_time Optional[str] None End time to filter events (ISO format, e.g., '2025-01-31T23:59:59Z')

Returns: Dict[str, Any] — Dict containing the online meeting information including: - onlineMeetingId: The ID of the online meeting - eventId: The calendar event ID - subject: The meeting subject - joinUrl: The meeting join URL - startDateTime: Meeting start time - endDateTime: Meeting end time

Method MSTeamsToolkit.list_meeting_transcripts

List all transcripts for an online meeting.

list_meeting_transcripts(user_id: str, online_meeting_id: str) -> List[Dict[str, Any]]

Parameter Type Default Description
user_id str The user ID (GUID) or user principal name (email) who owns the meeting
online_meeting_id str The online meeting ID to list transcripts for

Returns: List[Dict[str, Any]] — List of dicts containing transcript information including: - id: The transcript ID - createdDateTime: When the transcript was created - meetingId: The meeting ID - meetingOrganizerId: The organizer's user ID

Method MSTeamsToolkit.get_meeting_transcript

Download a meeting transcript content.

get_meeting_transcript(user_id: str, online_meeting_id: str, transcript_id: str, format: str = 'text/vtt') -> Dict[str, Any]

Parameter Type Default Description
user_id str The user ID (GUID) or user principal name (email) who owns the meeting
online_meeting_id str The online meeting ID
transcript_id str The transcript ID to download
format str 'text/vtt' The format for the transcript content: - 'text/vtt' (WebVTT with timestamps, default) - 'text/plain' (plain text without timestamps)

Returns: Dict[str, Any] — Dict containing: - transcriptId: The transcript ID - format: The requested format - content: The transcript content as text

Class SendDirectMessageInput

Input schema for sending direct message to a user.

Fields:

Field Type Default Description
recipient_email str Email address of the recipient user
message Union[str, Dict[str, Any]] Message content: plain text, Adaptive Card JSON string, or dict

Class SendMessageToChannelInput

Input schema for sending message to a Teams channel.

Fields:

Field Type Default Description
team_id str The Team ID where the channel exists
channel_id str The Channel ID to post the message to
webhook_url Optional[str] None Incoming webhook URL for the channel (alternative to team_id/channel_id)
message Union[str, Dict[str, Any]] Message content: plain text, Adaptive Card JSON string, or dict

Class SendMessageToChatInput

Input schema for sending message to a Teams chat.

Fields:

Field Type Default Description
chat_id str The Chat ID to send the message to
message Union[str, Dict[str, Any]] Message content: plain text, Adaptive Card JSON string, or dict

Function create_msteams_toolkit

Create and return a configured MSTeamsToolkit instance.

create_msteams_toolkit(tenant_id: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, as_user: bool = False, username: Optional[str] = None, password: Optional[str] = None, **kwargs) -> MSTeamsToolkit

Parameter Type Default Description
tenant_id Optional[str] None Azure AD tenant ID
client_id Optional[str] None Azure AD application client ID
client_secret Optional[str] None Azure AD application client secret
as_user bool False If True, use delegated user permissions
username Optional[str] None Username for delegated auth
password Optional[str] None Password for delegated auth
**kwargs {} Additional toolkit arguments

Returns: MSTeamsToolkit — Configured MSTeamsToolkit instance

Alias tool_schema

Re-exported from parrot_tools.decorators.tool_schema.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally