universal-mcp-applications 0.1.39rc8__py3-none-any.whl → 0.1.39rc16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of universal-mcp-applications might be problematic. Click here for more details.

Files changed (45) hide show
  1. universal_mcp/applications/BEST_PRACTICES.md +1 -1
  2. universal_mcp/applications/airtable/app.py +13 -13
  3. universal_mcp/applications/apollo/app.py +2 -2
  4. universal_mcp/applications/aws_s3/app.py +30 -19
  5. universal_mcp/applications/browser_use/app.py +10 -7
  6. universal_mcp/applications/contentful/app.py +4 -4
  7. universal_mcp/applications/crustdata/app.py +2 -2
  8. universal_mcp/applications/e2b/app.py +3 -4
  9. universal_mcp/applications/elevenlabs/README.md +27 -3
  10. universal_mcp/applications/elevenlabs/app.py +753 -48
  11. universal_mcp/applications/exa/app.py +18 -11
  12. universal_mcp/applications/falai/README.md +5 -7
  13. universal_mcp/applications/falai/app.py +160 -159
  14. universal_mcp/applications/firecrawl/app.py +14 -15
  15. universal_mcp/applications/ghost_content/app.py +4 -4
  16. universal_mcp/applications/github/app.py +2 -2
  17. universal_mcp/applications/gong/app.py +2 -2
  18. universal_mcp/applications/google_docs/README.md +15 -14
  19. universal_mcp/applications/google_docs/app.py +5 -4
  20. universal_mcp/applications/google_gemini/app.py +61 -17
  21. universal_mcp/applications/google_sheet/README.md +2 -1
  22. universal_mcp/applications/google_sheet/app.py +55 -0
  23. universal_mcp/applications/heygen/README.md +10 -32
  24. universal_mcp/applications/heygen/app.py +350 -744
  25. universal_mcp/applications/klaviyo/app.py +2 -2
  26. universal_mcp/applications/linkedin/README.md +14 -2
  27. universal_mcp/applications/linkedin/app.py +411 -38
  28. universal_mcp/applications/ms_teams/app.py +420 -1285
  29. universal_mcp/applications/notion/app.py +2 -2
  30. universal_mcp/applications/openai/app.py +1 -1
  31. universal_mcp/applications/perplexity/app.py +6 -7
  32. universal_mcp/applications/reddit/app.py +4 -4
  33. universal_mcp/applications/resend/app.py +31 -32
  34. universal_mcp/applications/rocketlane/app.py +2 -2
  35. universal_mcp/applications/scraper/app.py +51 -21
  36. universal_mcp/applications/semrush/app.py +1 -1
  37. universal_mcp/applications/serpapi/app.py +8 -7
  38. universal_mcp/applications/shopify/app.py +5 -7
  39. universal_mcp/applications/shortcut/app.py +3 -2
  40. universal_mcp/applications/slack/app.py +2 -2
  41. universal_mcp/applications/twilio/app.py +14 -13
  42. {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/METADATA +1 -1
  43. {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/RECORD +45 -45
  44. {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/WHEEL +0 -0
  45. {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
1
- from typing import Any
1
+ from typing import Any, Literal
2
2
  from universal_mcp.applications.application import APIApplication
3
3
  from universal_mcp.integrations import Integration
4
4
 
@@ -8,100 +8,63 @@ class MsTeamsApp(APIApplication):
8
8
  super().__init__(name="ms_teams", integration=integration, **kwargs)
9
9
  self.base_url = "https://graph.microsoft.com/v1.0"
10
10
 
11
- async def get_user_chats(
11
+ async def get_me(
12
12
  self,
13
- top: int | None = None,
14
- skip: int | None = None,
15
- search: str | None = None,
16
- filter: str | None = None,
17
- count: bool | None = None,
18
- orderby: list[str] | None = None,
19
13
  select: list[str] | None = None,
20
14
  expand: list[str] | None = None,
21
15
  ) -> dict[str, Any]:
22
16
  """
23
- Retrieves a collection of chats the authenticated user is participating in. Supports optional OData query parameters for advanced filtering, sorting, pagination, and field selection, enabling customized data retrieval from the Microsoft Graph API.
17
+ Get the currently signed-in user.
24
18
 
25
19
  Args:
26
- top (integer): Show only the first n items Example: '50'.
27
- skip (integer): Skip the first n items
28
- search (string): Search items by search phrases
29
- filter (string): Filter items by property values
30
- count (boolean): Include count of items
31
- orderby (array): Order items by property values
32
- select (array): Select properties to be returned
33
- expand (array): Expand related entities
20
+ select (array): Select specific properties to return.
21
+ expand (array): Expand related entities.
34
22
 
35
23
  Returns:
36
- dict[str, Any]: Retrieved collection
24
+ dict[str, Any]: The user resource.
37
25
 
38
26
  Raises:
39
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
27
+ HTTPStatusError: If the API request fails.
40
28
 
41
29
  Tags:
42
- chats.chat, important
30
+ user, me, read, profile
43
31
  """
44
- url = f"{self.base_url}/chats"
32
+ url = f"{self.base_url}/me"
33
+
34
+ # Helper to format list params
35
+ def fmt(val):
36
+ return ",".join(val) if isinstance(val, list) else val
37
+
45
38
  query_params = {
46
- k: v
39
+ k: fmt(v)
47
40
  for k, v in [
48
- ("$top", top),
49
- ("$skip", skip),
50
- ("$search", search),
51
- ("$filter", filter),
52
- ("$count", count),
53
- ("$orderby", orderby),
54
41
  ("$select", select),
55
42
  ("$expand", expand),
56
43
  ]
57
44
  if v is not None
58
45
  }
46
+
59
47
  response = await self._aget(url, params=query_params)
60
48
  return self._handle_response(response)
61
49
 
62
- async def get_joined_teams(self) -> list[dict[str, Any]]:
63
- """
64
- Fetches all Microsoft Teams the authenticated user belongs to by querying the `/me/joinedTeams` Graph API endpoint. It returns a list of dictionaries, where each dictionary represents a single team's details, unlike functions that list channels or chats for a specific team.
65
50
 
66
- Returns:
67
- A list of dictionaries, where each dictionary represents a team.
51
+ # Chat Management
68
52
 
69
- Raises:
70
- httpx.HTTPStatusError: If the API request fails due to authentication or other issues.
71
-
72
- Tags:
73
- read, list, teams, microsoft-teams, api, important
74
- """
75
- url = f"{self.base_url}/me/joinedTeams"
76
- response = await self._aget(url)
77
- data = self._handle_response(response)
78
- return data.get("value", [])
79
-
80
- async def list_channels_for_team(
53
+ async def get_user_chats(
81
54
  self,
82
- team_id: str,
83
55
  top: int | None = None,
84
- skip: int | None = None,
85
- search: str | None = None,
56
+ expand: list[Literal["members", "lastMessagePreview"]] | None = None,
86
57
  filter: str | None = None,
87
- count: bool | None = None,
88
- orderby: list[str] | None = None,
89
- select: list[str] | None = None,
90
- expand: list[str] | None = None,
58
+ orderby: Literal["lastMessagePreview/createdDateTime desc"] | None = None,
91
59
  ) -> dict[str, Any]:
92
60
  """
93
- Retrieves the collection of channels for a specified Microsoft Teams team by its ID. It supports advanced OData query parameters for filtering, sorting, and pagination, distinguishing it from functions that fetch single channels like `get_channel_details`.
61
+ Retrieves a collection of chats the authenticated user is participating in. Supports optional OData query parameters for advanced filtering, sorting, pagination, and field selection, enabling customized data retrieval from the Microsoft Graph API.
94
62
 
95
63
  Args:
96
- team_id (string): team-id
97
- top (integer): Show only the first n items Example: '50'.
98
- skip (integer): Skip the first n items
99
- search (string): Search items by search phrases
100
- filter (string): Filter items by property values
101
- count (boolean): Include count of items
102
- orderby (array): Order items by property values
103
- select (array): Select properties to be returned
104
- expand (array): Expand related entities
64
+ top (integer): Controls the number of items per response. Maximum allowed $top value is 50.
65
+ expand (array): Currently supports 'members' and 'lastMessagePreview' properties.
66
+ filter (string): Filters results.
67
+ orderby (string): Currently supports 'lastMessagePreview/createdDateTime desc'. Ascending order is currently not supported.
105
68
 
106
69
  Returns:
107
70
  dict[str, Any]: Retrieved collection
@@ -110,182 +73,70 @@ class MsTeamsApp(APIApplication):
110
73
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
111
74
 
112
75
  Tags:
113
- teams.channel, important
76
+ chats.chat, important
114
77
  """
115
- if team_id is None:
116
- raise ValueError("Missing required parameter 'team-id'.")
117
- url = f"{self.base_url}/teams/{team_id}/channels"
78
+ url = f"{self.base_url}/chats"
79
+ # Helper to format list params
80
+ def fmt(val):
81
+ return ",".join(val) if isinstance(val, list) else val
82
+
118
83
  query_params = {
119
- k: v
84
+ k: fmt(v)
120
85
  for k, v in [
121
86
  ("$top", top),
122
- ("$skip", skip),
123
- ("$search", search),
87
+ ("$expand", expand),
124
88
  ("$filter", filter),
125
- ("$count", count),
126
89
  ("$orderby", orderby),
127
- ("$select", select),
128
- ("$expand", expand),
129
90
  ]
130
91
  if v is not None
131
92
  }
132
93
  response = await self._aget(url, params=query_params)
133
94
  return self._handle_response(response)
134
95
 
135
- async def send_chat_message(self, chat_id: str, content: str) -> dict[str, Any]:
136
- """
137
- Posts a new message to a specific Microsoft Teams chat using its unique ID. This function targets direct or group chats, distinguishing it from `send_channel_message`, which posts to public team channels, and `reply_to_chat_message`, which responds to existing messages.
138
-
139
- Args:
140
- chat_id: The unique identifier of the chat.
141
- content: The message content to send (can be plain text or HTML).
142
-
143
- Returns:
144
- A dictionary containing the API response for the sent message, including its ID.
145
-
146
- Raises:
147
- httpx.HTTPStatusError: If the API request fails due to invalid ID, permissions, etc.
148
-
149
- Tags:
150
- create, send, message, chat, microsoft-teams, api, important
151
- """
152
- url = f"{self.base_url}/chats/{chat_id}/messages"
153
- payload = {"body": {"content": content}}
154
- response = await self._apost(url, data=payload)
155
- return self._handle_response(response)
156
-
157
- async def send_channel_message(self, team_id: str, channel_id: str, content: str) -> dict[str, Any]:
158
- """
159
- Posts a new message to a specified team channel, initiating a new conversation thread. Unlike `reply_to_channel_message`, which replies to a message, this function starts a new topic. It's distinct from `send_chat_message`, which is for private or group chats, not team channels.
160
-
161
- Args:
162
- team_id: The unique identifier of the team.
163
- channel_id: The unique identifier of the channel within the team.
164
- content: The message content to send (can be plain text or HTML).
165
-
166
- Returns:
167
- A dictionary containing the API response for the sent message, including its ID.
168
-
169
- Raises:
170
- httpx.HTTPStatusError: If the API request fails due to invalid IDs, permissions, etc.
171
-
172
- Tags:
173
- create, send, message, channel, microsoft-teams, api, important
174
- """
175
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages"
176
- payload = {"body": {"content": content}}
177
- response = await self._apost(url, data=payload)
178
- return self._handle_response(response)
179
-
180
- async def reply_to_channel_message(self, team_id: str, channel_id: str, message_id: str, content: str) -> dict[str, Any]:
181
- """
182
- Posts a reply to a specific message within a Microsoft Teams channel. It uses the team, channel, and original message IDs to target an existing conversation thread, distinguishing it from `send_channel_message` which starts a new one.
183
-
184
- Args:
185
- team_id: The unique identifier of the team.
186
- channel_id: The unique identifier of the channel.
187
- message_id: The unique identifier of the message to reply to.
188
- content: The reply message content (can be plain text or HTML).
189
-
190
- Returns:
191
- A dictionary containing the API response for the sent reply, including its ID.
192
-
193
- Raises:
194
- httpx.HTTPStatusError: If the API request fails due to invalid IDs, permissions, etc.
195
-
196
- Tags:
197
- create, send, reply, message, channel, microsoft-teams, api, important
198
- """
199
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{message_id}/replies"
200
- payload = {"body": {"content": content}}
201
- response = await self._apost(url, data=payload)
202
- return self._handle_response(response)
203
-
204
96
  async def create_chat(
205
97
  self,
206
- id: str | None = None,
207
- chatType: str | None = None,
208
- createdDateTime: str | None = None,
209
- isHiddenForAllMembers: bool | None = None,
210
- lastUpdatedDateTime: str | None = None,
211
- onlineMeetingInfo: dict[str, dict[str, Any]] | None = None,
212
- tenantId: str | None = None,
98
+ chatType: Literal["oneOnOne", "group"] | str,
99
+ members: list[dict[str, Any]],
213
100
  topic: str | None = None,
214
- viewpoint: dict[str, dict[str, Any]] | None = None,
215
- webUrl: str | None = None,
216
- installedApps: list[Any] | None = None,
217
- lastMessagePreview: Any | None = None,
218
- members: list[Any] | None = None,
219
- messages: list[Any] | None = None,
220
- permissionGrants: list[Any] | None = None,
221
- pinnedMessages: list[Any] | None = None,
222
- tabs: list[Any] | None = None,
223
- ) -> Any:
101
+ ) -> dict[str, Any]:
224
102
  """
225
- Creates a new one-on-one or group chat in Microsoft Teams. This function provisions a new conversation using optional parameters like chatType and members, distinguishing it from functions that create teams (`create_team`) or send messages to existing chats (`send_chat_message`).
103
+ Creates a new one-on-one or group chat in Microsoft Teams. This function provisions a new conversation using required parameters like chatType and members.
226
104
 
227
105
  Args:
228
- id (string): The unique identifier for an entity. Read-only.
229
- chatType (string): chatType
230
- createdDateTime (string): Date and time at which the chat was created. Read-only.
231
- isHiddenForAllMembers (boolean): Indicates whether the chat is hidden for all its members. Read-only.
232
- lastUpdatedDateTime (string): Date and time at which the chat was renamed or the list of members was last changed. Read-only.
233
- onlineMeetingInfo (object): onlineMeetingInfo
234
- tenantId (string): The identifier of the tenant in which the chat was created. Read-only.
106
+ chatType (string): The type of chat. Possible values are: oneOnOne, group.
107
+ members (array): A collection of member dictionaries. For oneOnOne chats, typically 2 users. For group chats, multiple users. Each member should specify roles and user binding (e.g. `{'@odata.type': '#microsoft.graph.aadUserConversationMember', 'roles': ['owner'], 'user@odata.bind': 'https://graph.microsoft.com/v1.0/users(\\'<user-id>\\')'}`).
235
108
  topic (string): (Optional) Subject or topic for the chat. Only available for group chats.
236
- viewpoint (object): viewpoint
237
- webUrl (string): The URL for the chat in Microsoft Teams. The URL should be treated as an opaque blob, and not parsed. Read-only.
238
- installedApps (array): A collection of all the apps in the chat. Nullable.
239
- lastMessagePreview (string): lastMessagePreview
240
- members (array): A collection of all the members in the chat. Nullable.
241
- messages (array): A collection of all the messages in the chat. Nullable.
242
- permissionGrants (array): A collection of permissions granted to apps for the chat.
243
- pinnedMessages (array): A collection of all the pinned messages in the chat. Nullable.
244
- tabs (array): A collection of all the tabs in the chat. Nullable.
245
109
 
246
110
  Returns:
247
- Any: Created entity
111
+ dict[str, Any]: The newly created chat entity.
248
112
 
249
113
  Raises:
250
114
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
251
115
 
252
116
  Tags:
253
- chats.chat
117
+ chats.chat, create
254
118
  """
255
- request_body_data = None
256
119
  request_body_data = {
257
- "id": id,
258
120
  "chatType": chatType,
259
- "createdDateTime": createdDateTime,
260
- "isHiddenForAllMembers": isHiddenForAllMembers,
261
- "lastUpdatedDateTime": lastUpdatedDateTime,
262
- "onlineMeetingInfo": onlineMeetingInfo,
263
- "tenantId": tenantId,
264
- "topic": topic,
265
- "viewpoint": viewpoint,
266
- "webUrl": webUrl,
267
- "installedApps": installedApps,
268
- "lastMessagePreview": lastMessagePreview,
269
121
  "members": members,
270
- "messages": messages,
271
- "permissionGrants": permissionGrants,
272
- "pinnedMessages": pinnedMessages,
273
- "tabs": tabs,
122
+ "topic": topic,
274
123
  }
124
+ # Filter explicitly None values, though for required ones they should be validated by type hints/caller
275
125
  request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
126
+
276
127
  url = f"{self.base_url}/chats"
277
- query_params = {}
278
- response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
128
+ response = await self._apost(url, data=request_body_data, content_type="application/json")
279
129
  return self._handle_response(response)
280
130
 
281
- async def get_chat_details(self, chat_id: str, select: list[str] | None = None, expand: list[str] | None = None) -> Any:
131
+ async def get_chat_details(
132
+ self,
133
+ chat_id: str,
134
+ ) -> Any:
282
135
  """
283
- Retrieves the properties and relationships of a specific chat conversation by its unique ID. Unlike `get_user_chats` which lists all chats, this targets one chat. Optional parameters can select specific fields or expand related entities like members or apps to customize the returned data.
136
+ Retrieves the properties and relationships of a specific chat conversation by its unique ID.
284
137
 
285
138
  Args:
286
- chat_id (string): chat-id
287
- select (array): Select properties to be returned
288
- expand (array): Expand related entities
139
+ chat_id (string): The unique identifier of the chat.
289
140
 
290
141
  Returns:
291
142
  Any: Retrieved entity
@@ -294,353 +145,154 @@ class MsTeamsApp(APIApplication):
294
145
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
295
146
 
296
147
  Tags:
297
- chats.chat
148
+ chats.chat, read
298
149
  """
299
150
  if chat_id is None:
300
151
  raise ValueError("Missing required parameter 'chat-id'.")
301
152
  url = f"{self.base_url}/chats/{chat_id}"
302
- query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
303
- response = await self._aget(url, params=query_params)
153
+ response = await self._aget(url)
304
154
  return self._handle_response(response)
305
155
 
306
156
  async def update_chat_details(
307
157
  self,
308
158
  chat_id: str,
309
- id: str | None = None,
310
- chatType: str | None = None,
311
- createdDateTime: str | None = None,
312
- isHiddenForAllMembers: bool | None = None,
313
- lastUpdatedDateTime: str | None = None,
314
- onlineMeetingInfo: dict[str, dict[str, Any]] | None = None,
315
- tenantId: str | None = None,
316
159
  topic: str | None = None,
317
- viewpoint: dict[str, dict[str, Any]] | None = None,
318
- webUrl: str | None = None,
319
- installedApps: list[Any] | None = None,
320
- lastMessagePreview: Any | None = None,
321
- members: list[Any] | None = None,
322
- messages: list[Any] | None = None,
323
- permissionGrants: list[Any] | None = None,
324
- pinnedMessages: list[Any] | None = None,
325
- tabs: list[Any] | None = None,
326
160
  ) -> Any:
327
161
  """
328
- Updates properties of a specific chat, such as its topic, using its unique ID. This function performs a partial update (PATCH), distinguishing it from `get_chat_details` which only retrieves data, and `create_chat` which creates an entirely new chat conversation.
162
+ Updates properties of a specific chat, such as its topic, using its unique ID. This function performs a partial update (PATCH). Currently, only the 'topic' property can be updated for group chats.
329
163
 
330
164
  Args:
331
- chat_id (string): chat-id
332
- id (string): The unique identifier for an entity. Read-only.
333
- chatType (string): chatType
334
- createdDateTime (string): Date and time at which the chat was created. Read-only.
335
- isHiddenForAllMembers (boolean): Indicates whether the chat is hidden for all its members. Read-only.
336
- lastUpdatedDateTime (string): Date and time at which the chat was renamed or the list of members was last changed. Read-only.
337
- onlineMeetingInfo (object): onlineMeetingInfo
338
- tenantId (string): The identifier of the tenant in which the chat was created. Read-only.
339
- topic (string): (Optional) Subject or topic for the chat. Only available for group chats.
340
- viewpoint (object): viewpoint
341
- webUrl (string): The URL for the chat in Microsoft Teams. The URL should be treated as an opaque blob, and not parsed. Read-only.
342
- installedApps (array): A collection of all the apps in the chat. Nullable.
343
- lastMessagePreview (string): lastMessagePreview
344
- members (array): A collection of all the members in the chat. Nullable.
345
- messages (array): A collection of all the messages in the chat. Nullable.
346
- permissionGrants (array): A collection of permissions granted to apps for the chat.
347
- pinnedMessages (array): A collection of all the pinned messages in the chat. Nullable.
348
- tabs (array): A collection of all the tabs in the chat. Nullable.
165
+ chat_id (string): The unique identifier of the chat.
166
+ topic (string): (Optional) The new subject or topic for the chat. Only applicable for group chats.
349
167
 
350
168
  Returns:
351
- Any: Success
169
+ Any: Variable response depending on the API, typically the updated entity or status.
352
170
 
353
171
  Raises:
354
172
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
355
173
 
356
174
  Tags:
357
- chats.chat
175
+ chats.chat, update
358
176
  """
359
177
  if chat_id is None:
360
178
  raise ValueError("Missing required parameter 'chat-id'.")
361
- request_body_data = None
362
- request_body_data = {
363
- "id": id,
364
- "chatType": chatType,
365
- "createdDateTime": createdDateTime,
366
- "isHiddenForAllMembers": isHiddenForAllMembers,
367
- "lastUpdatedDateTime": lastUpdatedDateTime,
368
- "onlineMeetingInfo": onlineMeetingInfo,
369
- "tenantId": tenantId,
370
- "topic": topic,
371
- "viewpoint": viewpoint,
372
- "webUrl": webUrl,
373
- "installedApps": installedApps,
374
- "lastMessagePreview": lastMessagePreview,
375
- "members": members,
376
- "messages": messages,
377
- "permissionGrants": permissionGrants,
378
- "pinnedMessages": pinnedMessages,
379
- "tabs": tabs,
380
- }
179
+
180
+ request_body_data = {"topic": topic}
181
+ # Filter explicitly None values
381
182
  request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
382
- url = f"{self.base_url}/chats/{chat_id}"
383
- query_params = {}
384
- response = self._patch(url, data=request_body_data, params=query_params)
385
- return self._handle_response(response)
386
-
387
- async def list_installed_chat_apps(
388
- self,
389
- chat_id: str,
390
- top: int | None = None,
391
- skip: int | None = None,
392
- search: str | None = None,
393
- filter: str | None = None,
394
- count: bool | None = None,
395
- orderby: list[str] | None = None,
396
- select: list[str] | None = None,
397
- expand: list[str] | None = None,
398
- ) -> dict[str, Any]:
399
- """
400
- Retrieves applications installed in a specific chat, identified by `chat_id`. Differentiating from `list_user_installed_apps`, which targets a user's personal scope, this function queries a single conversation. It supports optional parameters for advanced filtering, sorting, and pagination to customize the returned collection.
401
-
402
- Args:
403
- chat_id (string): chat-id
404
- top (integer): Show only the first n items Example: '50'.
405
- skip (integer): Skip the first n items
406
- search (string): Search items by search phrases
407
- filter (string): Filter items by property values
408
- count (boolean): Include count of items
409
- orderby (array): Order items by property values
410
- select (array): Select properties to be returned
411
- expand (array): Expand related entities
412
-
413
- Returns:
414
- dict[str, Any]: Retrieved collection
183
+
184
+ if not request_body_data:
185
+ raise ValueError("No updateable parameters provided.")
415
186
 
416
- Raises:
417
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
418
-
419
- Tags:
420
- chats.teamsAppInstallation
421
- """
422
- if chat_id is None:
423
- raise ValueError("Missing required parameter 'chat-id'.")
424
- url = f"{self.base_url}/chats/{chat_id}/installedApps"
425
- query_params = {
426
- k: v
427
- for k, v in [
428
- ("$top", top),
429
- ("$skip", skip),
430
- ("$search", search),
431
- ("$filter", filter),
432
- ("$count", count),
433
- ("$orderby", orderby),
434
- ("$select", select),
435
- ("$expand", expand),
436
- ]
437
- if v is not None
438
- }
439
- response = await self._aget(url, params=query_params)
187
+ url = f"{self.base_url}/chats/{chat_id}"
188
+ response = await self._apatch(url, data=request_body_data, content_type="application/json")
440
189
  return self._handle_response(response)
441
190
 
442
191
  async def list_chat_members(
443
192
  self,
444
193
  chat_id: str,
445
- top: int | None = None,
446
- skip: int | None = None,
447
- search: str | None = None,
448
- filter: str | None = None,
449
- count: bool | None = None,
450
- orderby: list[str] | None = None,
451
- select: list[str] | None = None,
452
- expand: list[str] | None = None,
453
- ) -> dict[str, Any]:
194
+ ) -> list[dict[str, Any]]:
454
195
  """
455
- Retrieves a collection of all members in a specific chat using its ID. It supports OData query parameters for pagination, filtering, and sorting. Unlike `get_chat_member`, which fetches a single individual, this function returns the entire collection of members for the specified chat.
196
+ Retrieves a collection of all members in a specific chat using its ID.
197
+ Note: The Microsoft Graph API for getting chat members does NOT support OData query parameters like $top, $filter, etc.
456
198
 
457
199
  Args:
458
- chat_id (string): chat-id
459
- top (integer): Show only the first n items Example: '50'.
460
- skip (integer): Skip the first n items
461
- search (string): Search items by search phrases
462
- filter (string): Filter items by property values
463
- count (boolean): Include count of items
464
- orderby (array): Order items by property values
465
- select (array): Select properties to be returned
466
- expand (array): Expand related entities
200
+ chat_id (string): The unique identifier of the chat.
467
201
 
468
202
  Returns:
469
- dict[str, Any]: Retrieved collection
203
+ list[dict[str, Any]]: A list of conversationMember objects.
470
204
 
471
205
  Raises:
472
206
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
473
207
 
474
208
  Tags:
475
- chats.conversationMember
209
+ chats.conversationMember, list, read
476
210
  """
477
211
  if chat_id is None:
478
212
  raise ValueError("Missing required parameter 'chat-id'.")
479
213
  url = f"{self.base_url}/chats/{chat_id}/members"
480
- query_params = {
481
- k: v
482
- for k, v in [
483
- ("$top", top),
484
- ("$skip", skip),
485
- ("$search", search),
486
- ("$filter", filter),
487
- ("$count", count),
488
- ("$orderby", orderby),
489
- ("$select", select),
490
- ("$expand", expand),
491
- ]
492
- if v is not None
493
- }
494
- response = await self._aget(url, params=query_params)
495
- return self._handle_response(response)
496
-
497
- async def add_member_to_chat(
498
- self,
499
- chat_id: str,
500
- id: str | None = None,
501
- displayName: str | None = None,
502
- roles: list[str] | None = None,
503
- visibleHistoryStartDateTime: str | None = None,
504
- ) -> Any:
505
- """
506
- Adds a new member to a specific Microsoft Teams chat using its `chat_id`. This function allows for configuring member roles and chat history visibility. It is the direct counterpart to `delete_chat_member`, performing the 'create' action for a chat's membership.
507
-
508
- Args:
509
- chat_id (string): chat-id
510
- id (string): The unique identifier for an entity. Read-only.
511
- displayName (string): The display name of the user.
512
- roles (array): The roles for that user. This property contains more qualifiers only when relevant - for example, if the member has owner privileges, the roles property contains owner as one of the values. Similarly, if the member is an in-tenant guest, the roles property contains guest as one of the values. A basic member shouldn't have any values specified in the roles property. An Out-of-tenant external member is assigned the owner role.
513
- visibleHistoryStartDateTime (string): The timestamp denoting how far back a conversation's history is shared with the conversation member. This property is settable only for members of a chat.
514
-
515
- Returns:
516
- Any: Created navigation property.
517
-
518
- Raises:
519
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
520
-
521
- Tags:
522
- chats.conversationMember
523
- """
524
- if chat_id is None:
525
- raise ValueError("Missing required parameter 'chat-id'.")
526
- request_body_data = None
527
- request_body_data = {
528
- "id": id,
529
- "displayName": displayName,
530
- "roles": roles,
531
- "visibleHistoryStartDateTime": visibleHistoryStartDateTime,
532
- }
533
- request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
534
- url = f"{self.base_url}/chats/{chat_id}/members"
535
- query_params = {}
536
- response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
537
- return self._handle_response(response)
214
+
215
+ # This endpoint generally does not support OData params, so we send none.
216
+ response = await self._aget(url)
217
+ data = self._handle_response(response)
218
+ return data.get("value", [])
538
219
 
539
220
  async def get_chat_member(
540
- self, chat_id: str, conversationMember_id: str, select: list[str] | None = None, expand: list[str] | None = None
221
+ self, chat_id: str, conversationMember_id: str
541
222
  ) -> Any:
542
223
  """
543
- Retrieves detailed information for a specific member within a chat using their unique ID. This function targets a single individual, distinguishing it from `list_chat_members` which returns all members. The response can be customized by selecting specific properties or expanding related entities.
224
+ Retrieves detailed information for a specific member within a chat using their unique ID.
225
+ Note: The Microsoft Graph API for this endpoint does NOT support OData query parameters.
544
226
 
545
227
  Args:
546
- chat_id (string): chat-id
547
- conversationMember_id (string): conversationMember-id
548
- select (array): Select properties to be returned
549
- expand (array): Expand related entities
228
+ chat_id (string): The unique identifier of the chat.
229
+ conversationMember_id (string): The unique identifier of the member.
550
230
 
551
231
  Returns:
552
- Any: Retrieved navigation property
232
+ Any: Retrieved conversationMember entity.
553
233
 
554
234
  Raises:
555
235
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
556
236
 
557
237
  Tags:
558
- chats.conversationMember
238
+ chats.conversationMember, read
559
239
  """
560
240
  if chat_id is None:
561
241
  raise ValueError("Missing required parameter 'chat-id'.")
562
242
  if conversationMember_id is None:
563
243
  raise ValueError("Missing required parameter 'conversationMember-id'.")
564
244
  url = f"{self.base_url}/chats/{chat_id}/members/{conversationMember_id}"
565
- query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
566
- response = await self._aget(url, params=query_params)
245
+
246
+ # This endpoint generally does not support OData params
247
+ response = await self._aget(url)
567
248
  return self._handle_response(response)
568
249
 
569
- async def delete_chat_member(self, chat_id: str, conversationMember_id: str) -> Any:
570
- """
571
- Removes a specific member from a chat using their unique ID and the chat's ID. This function sends a DELETE request to the Microsoft Graph API to permanently remove the user from the conversation, acting as the counterpart to `add_member_to_chat`.
572
-
573
- Args:
574
- chat_id (string): chat-id
575
- conversationMember_id (string): conversationMember-id
576
-
577
- Returns:
578
- Any: Success
579
-
580
- Raises:
581
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
582
-
583
- Tags:
584
- chats.conversationMember
585
- """
586
- if chat_id is None:
587
- raise ValueError("Missing required parameter 'chat-id'.")
588
- if conversationMember_id is None:
589
- raise ValueError("Missing required parameter 'conversationMember-id'.")
590
- url = f"{self.base_url}/chats/{chat_id}/members/{conversationMember_id}"
591
- query_params = {}
592
- response = await self._adelete(url, params=query_params)
593
- return self._handle_response(response)
250
+ # Chat Messages
594
251
 
595
252
  async def list_chat_messages(
596
253
  self,
597
254
  chat_id: str,
598
255
  top: int | None = None,
599
- skip: int | None = None,
600
- search: str | None = None,
256
+ orderby: list[Literal["lastModifiedDateTime desc", "createdDateTime desc"]] | None = None,
601
257
  filter: str | None = None,
602
- count: bool | None = None,
603
- orderby: list[str] | None = None,
604
- select: list[str] | None = None,
605
- expand: list[str] | None = None,
606
258
  ) -> dict[str, Any]:
607
259
  """
608
- Retrieves messages from a specific chat using its ID. Unlike `get_chat_message`, which fetches a single message, this function returns a collection and supports advanced querying for filtering, sorting, and pagination to refine the results.
260
+ Retrieves messages from a specific chat using its ID.
261
+
262
+ Supported OData parameters with strict limitations:
263
+ - $top: Controls the number of items per response. Maximum allowed value is 50.
264
+ - $orderby: Currently supports 'lastModifiedDateTime desc' (default) and 'createdDateTime desc'. Ascending order is NOT supported.
265
+ - $filter: Sets the date range filter for 'lastModifiedDateTime' (supports gt/lt) and 'createdDateTime' (supports lt).
266
+ Note: You can only filter results if 'orderby' is configured for the same property!
609
267
 
610
268
  Args:
611
- chat_id (string): chat-id
612
- top (integer): Show only the first n items Example: '50'.
613
- skip (integer): Skip the first n items
614
- search (string): Search items by search phrases
615
- filter (string): Filter items by property values
616
- count (boolean): Include count of items
617
- orderby (array): Order items by property values
618
- select (array): Select properties to be returned
619
- expand (array): Expand related entities
269
+ chat_id (string): The unique identifier of the chat.
270
+ top (integer): Show only the first n items. Max 50.
271
+ orderby (array): Order items by property values. Restrict to supported descending sorts.
272
+ filter (string): Filter items by property values. Must match orderby property.
620
273
 
621
274
  Returns:
622
- dict[str, Any]: Retrieved collection
275
+ dict[str, Any]: Retrieved collection of messages.
623
276
 
624
277
  Raises:
625
278
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
626
279
 
627
280
  Tags:
628
- chats.chatMessage
281
+ chats.chatMessage, list, read
629
282
  """
630
283
  if chat_id is None:
631
284
  raise ValueError("Missing required parameter 'chat-id'.")
632
285
  url = f"{self.base_url}/chats/{chat_id}/messages"
286
+ # Helper to format list params
287
+ def fmt(val):
288
+ return ",".join(val) if isinstance(val, list) else val
289
+
633
290
  query_params = {
634
- k: v
291
+ k: fmt(v)
635
292
  for k, v in [
636
293
  ("$top", top),
637
- ("$skip", skip),
638
- ("$search", search),
639
- ("$filter", filter),
640
- ("$count", count),
641
294
  ("$orderby", orderby),
642
- ("$select", select),
643
- ("$expand", expand),
295
+ ("$filter", filter),
644
296
  ]
645
297
  if v is not None
646
298
  }
@@ -648,1054 +300,537 @@ class MsTeamsApp(APIApplication):
648
300
  return self._handle_response(response)
649
301
 
650
302
  async def get_chat_message(
651
- self, chat_id: str, chatMessage_id: str, select: list[str] | None = None, expand: list[str] | None = None
303
+ self, chat_id: str, chatMessage_id: str
652
304
  ) -> Any:
653
305
  """
654
- Retrieves the full details of a single message from a specific chat using both chat and message IDs. This function targets an individual message, differentiating it from `list_chat_messages`, which retrieves a collection. Optional parameters can customize the response by selecting specific properties or expanding entities.
306
+ Retrieves the full details of a single message from a specific chat using both chat and message IDs.
307
+ Note: The Microsoft Graph API for this endpoint does NOT support OData query parameters like $select or $expand.
655
308
 
656
309
  Args:
657
- chat_id (string): chat-id
658
- chatMessage_id (string): chatMessage-id
659
- select (array): Select properties to be returned
660
- expand (array): Expand related entities
310
+ chat_id (string): The unique identifier of the chat.
311
+ chatMessage_id (string): The unique identifier of the message.
661
312
 
662
313
  Returns:
663
- Any: Retrieved navigation property
314
+ Any: Retrieved chatMessage entity.
664
315
 
665
316
  Raises:
666
317
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
667
318
 
668
319
  Tags:
669
- chats.chatMessage
320
+ chats.chatMessage, read
670
321
  """
671
322
  if chat_id is None:
672
323
  raise ValueError("Missing required parameter 'chat-id'.")
673
324
  if chatMessage_id is None:
674
325
  raise ValueError("Missing required parameter 'chatMessage-id'.")
675
326
  url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}"
676
- query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
677
- response = await self._aget(url, params=query_params)
327
+
328
+ # This endpoint explicitly does not support OData params
329
+ response = await self._aget(url)
678
330
  return self._handle_response(response)
679
331
 
680
- async def list_chat_message_replies(
681
- self,
682
- chat_id: str,
683
- chatMessage_id: str,
684
- top: int | None = None,
685
- skip: int | None = None,
686
- search: str | None = None,
687
- filter: str | None = None,
688
- count: bool | None = None,
689
- orderby: list[str] | None = None,
690
- select: list[str] | None = None,
691
- expand: list[str] | None = None,
692
- ) -> dict[str, Any]:
332
+ async def send_chat_message(self, chat_id: str, content: str) -> dict[str, Any]:
693
333
  """
694
- Retrieves all replies for a specific message within a chat, using the parent message's ID. This function, unlike `get_chat_reply_details`, returns a collection and supports OData query parameters for advanced filtering, sorting, and pagination of the results.
695
-
334
+ Posts a new message to a specific Microsoft Teams chat using its unique ID.
335
+
696
336
  Args:
697
- chat_id (string): chat-id
698
- chatMessage_id (string): chatMessage-id
699
- top (integer): Show only the first n items Example: '50'.
700
- skip (integer): Skip the first n items
701
- search (string): Search items by search phrases
702
- filter (string): Filter items by property values
703
- count (boolean): Include count of items
704
- orderby (array): Order items by property values
705
- select (array): Select properties to be returned
706
- expand (array): Expand related entities
337
+ chat_id (string): The unique identifier of the chat.
338
+ content (string): The message content to send (plain text or HTML).
707
339
 
708
340
  Returns:
709
- dict[str, Any]: Retrieved collection
341
+ dict[str, Any]: A dictionary containing the API response for the sent message, including its ID.
710
342
 
711
343
  Raises:
712
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
344
+ HTTPStatusError: If the API request fails due to invalid ID, permissions, etc.
713
345
 
714
346
  Tags:
715
- chats.chatMessage
347
+ chats.chatMessage, create, send, important
716
348
  """
717
349
  if chat_id is None:
718
350
  raise ValueError("Missing required parameter 'chat-id'.")
719
- if chatMessage_id is None:
720
- raise ValueError("Missing required parameter 'chatMessage-id'.")
721
- url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}/replies"
722
- query_params = {
723
- k: v
724
- for k, v in [
725
- ("$top", top),
726
- ("$skip", skip),
727
- ("$search", search),
728
- ("$filter", filter),
729
- ("$count", count),
730
- ("$orderby", orderby),
731
- ("$select", select),
732
- ("$expand", expand),
733
- ]
734
- if v is not None
735
- }
736
- response = await self._aget(url, params=query_params)
351
+
352
+ url = f"{self.base_url}/chats/{chat_id}/messages"
353
+ payload = {"body": {"content": content}}
354
+
355
+ response = await self._apost(url, data=payload)
737
356
  return self._handle_response(response)
738
357
 
739
- async def reply_to_chat_message(
358
+ # Channels
359
+
360
+ async def list_all_channels(
740
361
  self,
741
- chat_id: str,
742
- chatMessage_id: str,
743
- id: str | None = None,
744
- attachments: list[dict[str, dict[str, Any]]] | None = None,
745
- body: dict[str, dict[str, Any]] | None = None,
746
- channelIdentity: dict[str, dict[str, Any]] | None = None,
747
- chatId: str | None = None,
748
- createdDateTime: str | None = None,
749
- deletedDateTime: str | None = None,
750
- etag: str | None = None,
751
- eventDetail: dict[str, dict[str, Any]] | None = None,
752
- from_: Any | None = None,
753
- importance: str | None = None,
754
- lastEditedDateTime: str | None = None,
755
- lastModifiedDateTime: str | None = None,
756
- locale: str | None = None,
757
- mentions: list[dict[str, dict[str, Any]]] | None = None,
758
- messageHistory: list[dict[str, dict[str, Any]]] | None = None,
759
- messageType: str | None = None,
760
- policyViolation: dict[str, dict[str, Any]] | None = None,
761
- reactions: list[dict[str, dict[str, Any]]] | None = None,
762
- replyToId: str | None = None,
763
- subject: str | None = None,
764
- summary: str | None = None,
765
- webUrl: str | None = None,
766
- hostedContents: list[Any] | None = None,
767
- replies: list[Any] | None = None,
768
- ) -> Any:
362
+ team_id: str,
363
+ filter: str | None = None,
364
+ select: list[str] | None = None,
365
+ expand: list[str] | None = None,
366
+ ) -> dict[str, Any]:
769
367
  """
770
- Posts a reply to a specific message within a chat. This comprehensive function allows for detailed configuration of the reply's properties, like its body and attachments. It differs from `reply_to_channel_message`, which sends simpler replies to messages within team channels.
368
+ Retrieves the list of channels either in this team or shared with this team (incoming channels).
369
+ Supported OData parameters:
370
+ - $filter: Filter by property values.
371
+ - $select: Select specific properties to return (recommended for performance).
372
+ - $expand: Expand related entities.
771
373
 
772
374
  Args:
773
- chat_id (string): chat-id
774
- chatMessage_id (string): chatMessage-id
775
- id (string): The unique identifier for an entity. Read-only.
776
- attachments (array): References to attached objects like files, tabs, meetings etc.
777
- body (object): body
778
- channelIdentity (object): channelIdentity
779
- chatId (string): If the message was sent in a chat, represents the identity of the chat.
780
- createdDateTime (string): Timestamp of when the chat message was created.
781
- deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
782
- etag (string): Read-only. Version number of the chat message.
783
- eventDetail (object): eventDetail
784
- from_ (string): from
785
- importance (string): importance
786
- lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
787
- lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
788
- locale (string): Locale of the chat message set by the client. Always set to en-us.
789
- mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
790
- messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
791
- messageType (string): messageType
792
- policyViolation (object): policyViolation
793
- reactions (array): Reactions for this chat message (for example, Like).
794
- replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
795
- subject (string): The subject of the chat message, in plaintext.
796
- summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
797
- webUrl (string): Read-only. Link to the message in Microsoft Teams.
798
- hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
799
- replies (array): Replies for a specified message. Supports $expand for channel messages.
375
+ team_id (string): The unique identifier of the team.
376
+ filter (string): Filter items by property values.
377
+ select (array): Select properties to be returned.
378
+ expand (array): Expand related entities.
800
379
 
801
380
  Returns:
802
- Any: Created navigation property.
381
+ dict[str, Any]: Retrieved collection of channels.
803
382
 
804
383
  Raises:
805
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
384
+ HTTPStatusError: If the API request fails.
806
385
 
807
386
  Tags:
808
- chats.chatMessage
387
+ teams.channel, list, read
809
388
  """
810
- if chat_id is None:
811
- raise ValueError("Missing required parameter 'chat-id'.")
812
- if chatMessage_id is None:
813
- raise ValueError("Missing required parameter 'chatMessage-id'.")
814
- request_body_data = None
815
- request_body_data = {
816
- "id": id,
817
- "attachments": attachments,
818
- "body": body,
819
- "channelIdentity": channelIdentity,
820
- "chatId": chatId,
821
- "createdDateTime": createdDateTime,
822
- "deletedDateTime": deletedDateTime,
823
- "etag": etag,
824
- "eventDetail": eventDetail,
825
- "from": from_,
826
- "importance": importance,
827
- "lastEditedDateTime": lastEditedDateTime,
828
- "lastModifiedDateTime": lastModifiedDateTime,
829
- "locale": locale,
830
- "mentions": mentions,
831
- "messageHistory": messageHistory,
832
- "messageType": messageType,
833
- "policyViolation": policyViolation,
834
- "reactions": reactions,
835
- "replyToId": replyToId,
836
- "subject": subject,
837
- "summary": summary,
838
- "webUrl": webUrl,
839
- "hostedContents": hostedContents,
840
- "replies": replies,
841
- }
842
- request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
843
- url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}/replies"
844
- query_params = {}
845
- response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
846
- return self._handle_response(response)
847
-
848
- async def get_chat_reply_details(
849
- self, chat_id: str, chatMessage_id: str, chatMessage_id1: str, select: list[str] | None = None, expand: list[str] | None = None
850
- ) -> Any:
851
- """
852
- Retrieves a specific reply from a chat message thread using the chat, parent message, and reply IDs. Unlike `list_chat_message_replies`, which fetches all replies, this function targets a single reply for detailed information, allowing for customized field selection.
389
+ if team_id is None:
390
+ raise ValueError("Missing required parameter 'team-id'.")
853
391
 
854
- Args:
855
- chat_id (string): chat-id
856
- chatMessage_id (string): chatMessage-id
857
- chatMessage_id1 (string): chatMessage-id1
858
- select (array): Select properties to be returned
859
- expand (array): Expand related entities
392
+ url = f"{self.base_url}/teams/{team_id}/allChannels"
860
393
 
861
- Returns:
862
- Any: Retrieved navigation property
394
+ # Helper to format list params
395
+ def fmt(val):
396
+ return ",".join(val) if isinstance(val, list) else val
863
397
 
864
- Raises:
865
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
398
+ query_params = {
399
+ k: fmt(v)
400
+ for k, v in [
401
+ ("$filter", filter),
402
+ ("$select", select),
403
+ ("$expand", expand),
404
+ ]
405
+ if v is not None
406
+ }
866
407
 
867
- Tags:
868
- chats.chatMessage
869
- """
870
- if chat_id is None:
871
- raise ValueError("Missing required parameter 'chat-id'.")
872
- if chatMessage_id is None:
873
- raise ValueError("Missing required parameter 'chatMessage-id'.")
874
- if chatMessage_id1 is None:
875
- raise ValueError("Missing required parameter 'chatMessage-id1'.")
876
- url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}/replies/{chatMessage_id1}"
877
- query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
878
408
  response = await self._aget(url, params=query_params)
879
409
  return self._handle_response(response)
880
410
 
881
- async def create_team_from_group(
411
+ async def get_channel(
882
412
  self,
883
- group_id: str,
884
- id: str | None = None,
885
- classification: str | None = None,
886
- createdDateTime: str | None = None,
887
- description: str | None = None,
888
- displayName: str | None = None,
889
- firstChannelName: str | None = None,
890
- funSettings: dict[str, dict[str, Any]] | None = None,
891
- guestSettings: dict[str, dict[str, Any]] | None = None,
892
- internalId: str | None = None,
893
- isArchived: bool | None = None,
894
- memberSettings: dict[str, dict[str, Any]] | None = None,
895
- messagingSettings: dict[str, dict[str, Any]] | None = None,
896
- specialization: str | None = None,
897
- summary: dict[str, dict[str, Any]] | None = None,
898
- tenantId: str | None = None,
899
- visibility: str | None = None,
900
- webUrl: str | None = None,
901
- allChannels: list[Any] | None = None,
902
- channels: list[Any] | None = None,
903
- group: Any | None = None,
904
- incomingChannels: list[Any] | None = None,
905
- installedApps: list[Any] | None = None,
906
- members: list[Any] | None = None,
907
- operations: list[Any] | None = None,
908
- permissionGrants: list[Any] | None = None,
909
- photo: Any | None = None,
910
- primaryChannel: Any | None = None,
911
- schedule: Any | None = None,
912
- tags: list[Any] | None = None,
913
- template: Any | None = None,
914
- ) -> Any:
413
+ team_id: str,
414
+ channel_id: str,
415
+ select: list[str] | None = None,
416
+ expand: list[str] | None = None,
417
+ ) -> dict[str, Any]:
915
418
  """
916
- Enables Microsoft Teams functionality for a pre-existing Microsoft 365 group using its ID. This 'team-ifies' the group, allowing optional configuration of team properties. It differs from `create_team`, which provisions both a new team and its associated group simultaneously.
419
+ Retrieve the properties and relationships of a channel.
420
+ Supported OData parameters:
421
+ - $select: Select specific properties to return (recommended for performance).
422
+ - $expand: Expand related entities.
917
423
 
918
424
  Args:
919
- group_id (string): group-id
920
- id (string): The unique identifier for an entity. Read-only.
921
- classification (string): An optional label. Typically describes the data or business sensitivity of the team. Must match one of a preconfigured set in the tenant's directory.
922
- createdDateTime (string): Timestamp at which the team was created.
923
- description (string): An optional description for the team. Maximum length: 1,024 characters.
924
- displayName (string): The name of the team.
925
- firstChannelName (string): The name of the first channel in the team. This is an optional property, only used during team creation and isn't returned in methods to get and list teams.
926
- funSettings (object): funSettings
927
- guestSettings (object): guestSettings
928
- internalId (string): A unique ID for the team that was used in a few places such as the audit log/Office 365 Management Activity API.
929
- isArchived (boolean): Whether this team is in read-only mode.
930
- memberSettings (object): memberSettings
931
- messagingSettings (object): messagingSettings
932
- specialization (string): specialization
933
- summary (object): summary
934
- tenantId (string): The ID of the Microsoft Entra tenant.
935
- visibility (string): visibility
936
- webUrl (string): A hyperlink that goes to the team in the Microsoft Teams client. You get this URL when you right-click a team in the Microsoft Teams client and select Get link to team. This URL should be treated as an opaque blob, and not parsed.
937
- allChannels (array): List of channels either hosted in or shared with the team (incoming channels).
938
- channels (array): The collection of channels and messages associated with the team.
939
- group (string): group
940
- incomingChannels (array): List of channels shared with the team.
941
- installedApps (array): The apps installed in this team.
942
- members (array): Members and owners of the team.
943
- operations (array): The async operations that ran or are running on this team.
944
- permissionGrants (array): A collection of permissions granted to apps to access the team.
945
- photo (string): photo
946
- primaryChannel (string): primaryChannel
947
- schedule (string): schedule
948
- tags (array): The tags associated with the team.
949
- template (string): template
425
+ team_id (string): The unique identifier of the team.
426
+ channel_id (string): The unique identifier of the channel.
427
+ select (array): Select properties to be returned.
428
+ expand (array): Expand related entities.
950
429
 
951
430
  Returns:
952
- Any: Success
431
+ dict[str, Any]: Retrieved channel entity.
953
432
 
954
433
  Raises:
955
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
434
+ HTTPStatusError: If the API request fails.
956
435
 
957
436
  Tags:
958
- groups.team
959
- """
960
- if group_id is None:
961
- raise ValueError("Missing required parameter 'group-id'.")
962
- request_body_data = None
963
- request_body_data = {
964
- "id": id,
965
- "classification": classification,
966
- "createdDateTime": createdDateTime,
967
- "description": description,
968
- "displayName": displayName,
969
- "firstChannelName": firstChannelName,
970
- "funSettings": funSettings,
971
- "guestSettings": guestSettings,
972
- "internalId": internalId,
973
- "isArchived": isArchived,
974
- "memberSettings": memberSettings,
975
- "messagingSettings": messagingSettings,
976
- "specialization": specialization,
977
- "summary": summary,
978
- "tenantId": tenantId,
979
- "visibility": visibility,
980
- "webUrl": webUrl,
981
- "allChannels": allChannels,
982
- "channels": channels,
983
- "group": group,
984
- "incomingChannels": incomingChannels,
985
- "installedApps": installedApps,
986
- "members": members,
987
- "operations": operations,
988
- "permissionGrants": permissionGrants,
989
- "photo": photo,
990
- "primaryChannel": primaryChannel,
991
- "schedule": schedule,
992
- "tags": tags,
993
- "template": template,
994
- }
995
- request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
996
- url = f"{self.base_url}/groups/{group_id}/team"
997
- query_params = {}
998
- response = await self._aput(url, data=request_body_data, params=query_params, content_type="application/json")
999
- return self._handle_response(response)
1000
-
1001
- async def create_team(
1002
- self,
1003
- id: str | None = None,
1004
- classification: str | None = None,
1005
- createdDateTime: str | None = None,
1006
- description: str | None = None,
1007
- displayName: str | None = None,
1008
- firstChannelName: str | None = None,
1009
- funSettings: dict[str, dict[str, Any]] | None = None,
1010
- guestSettings: dict[str, dict[str, Any]] | None = None,
1011
- internalId: str | None = None,
1012
- isArchived: bool | None = None,
1013
- memberSettings: dict[str, dict[str, Any]] | None = None,
1014
- messagingSettings: dict[str, dict[str, Any]] | None = None,
1015
- specialization: str | None = None,
1016
- summary: dict[str, dict[str, Any]] | None = None,
1017
- tenantId: str | None = None,
1018
- visibility: str | None = None,
1019
- webUrl: str | None = None,
1020
- allChannels: list[Any] | None = None,
1021
- channels: list[Any] | None = None,
1022
- group: Any | None = None,
1023
- incomingChannels: list[Any] | None = None,
1024
- installedApps: list[Any] | None = None,
1025
- members: list[Any] | None = None,
1026
- operations: list[Any] | None = None,
1027
- permissionGrants: list[Any] | None = None,
1028
- photo: Any | None = None,
1029
- primaryChannel: Any | None = None,
1030
- schedule: Any | None = None,
1031
- tags: list[Any] | None = None,
1032
- template: Any | None = None,
1033
- ) -> Any:
437
+ teams.channel, read
1034
438
  """
1035
- Creates a new Microsoft Team and its associated Microsoft 365 group. This method builds a team from scratch, allowing specification of initial properties like display name, description, and members. It differs from `create_team_from_group`, which enables team functionality for an existing group.
1036
-
1037
- Args:
1038
- id (string): The unique identifier for an entity. Read-only.
1039
- classification (string): An optional label. Typically describes the data or business sensitivity of the team. Must match one of a preconfigured set in the tenant's directory.
1040
- createdDateTime (string): Timestamp at which the team was created.
1041
- description (string): An optional description for the team. Maximum length: 1,024 characters.
1042
- displayName (string): The name of the team.
1043
- firstChannelName (string): The name of the first channel in the team. This is an optional property, only used during team creation and isn't returned in methods to get and list teams.
1044
- funSettings (object): funSettings
1045
- guestSettings (object): guestSettings
1046
- internalId (string): A unique ID for the team that was used in a few places such as the audit log/Office 365 Management Activity API.
1047
- isArchived (boolean): Whether this team is in read-only mode.
1048
- memberSettings (object): memberSettings
1049
- messagingSettings (object): messagingSettings
1050
- specialization (string): specialization
1051
- summary (object): summary
1052
- tenantId (string): The ID of the Microsoft Entra tenant.
1053
- visibility (string): visibility
1054
- webUrl (string): A hyperlink that goes to the team in the Microsoft Teams client. You get this URL when you right-click a team in the Microsoft Teams client and select Get link to team. This URL should be treated as an opaque blob, and not parsed.
1055
- allChannels (array): List of channels either hosted in or shared with the team (incoming channels).
1056
- channels (array): The collection of channels and messages associated with the team.
1057
- group (string): group
1058
- incomingChannels (array): List of channels shared with the team.
1059
- installedApps (array): The apps installed in this team.
1060
- members (array): Members and owners of the team.
1061
- operations (array): The async operations that ran or are running on this team.
1062
- permissionGrants (array): A collection of permissions granted to apps to access the team.
1063
- photo (string): photo
1064
- primaryChannel (string): primaryChannel
1065
- schedule (string): schedule
1066
- tags (array): The tags associated with the team.
1067
- template (string): template
439
+ if team_id is None:
440
+ raise ValueError("Missing required parameter 'team-id'.")
441
+ if channel_id is None:
442
+ raise ValueError("Missing required parameter 'channel-id'.")
1068
443
 
1069
- Returns:
1070
- Any: Created entity
444
+ url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}"
1071
445
 
1072
- Raises:
1073
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
446
+ # Helper to format list params
447
+ def fmt(val):
448
+ return ",".join(val) if isinstance(val, list) else val
1074
449
 
1075
- Tags:
1076
- teams.team
1077
- """
1078
- request_body_data = None
1079
- request_body_data = {
1080
- "id": id,
1081
- "classification": classification,
1082
- "createdDateTime": createdDateTime,
1083
- "description": description,
1084
- "displayName": displayName,
1085
- "firstChannelName": firstChannelName,
1086
- "funSettings": funSettings,
1087
- "guestSettings": guestSettings,
1088
- "internalId": internalId,
1089
- "isArchived": isArchived,
1090
- "memberSettings": memberSettings,
1091
- "messagingSettings": messagingSettings,
1092
- "specialization": specialization,
1093
- "summary": summary,
1094
- "tenantId": tenantId,
1095
- "visibility": visibility,
1096
- "webUrl": webUrl,
1097
- "allChannels": allChannels,
1098
- "channels": channels,
1099
- "group": group,
1100
- "incomingChannels": incomingChannels,
1101
- "installedApps": installedApps,
1102
- "members": members,
1103
- "operations": operations,
1104
- "permissionGrants": permissionGrants,
1105
- "photo": photo,
1106
- "primaryChannel": primaryChannel,
1107
- "schedule": schedule,
1108
- "tags": tags,
1109
- "template": template,
450
+ query_params = {
451
+ k: fmt(v)
452
+ for k, v in [
453
+ ("$select", select),
454
+ ("$expand", expand),
455
+ ]
456
+ if v is not None
1110
457
  }
1111
- request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1112
- url = f"{self.base_url}/teams"
1113
- query_params = {}
1114
- response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
458
+
459
+ response = await self._aget(url, params=query_params)
1115
460
  return self._handle_response(response)
1116
461
 
1117
- async def get_channel_details(
1118
- self, team_id: str, channel_id: str, select: list[str] | None = None, expand: list[str] | None = None
1119
- ) -> Any:
462
+ async def get_primary_channel(
463
+ self,
464
+ team_id: str,
465
+ select: list[str] | None = None,
466
+ expand: list[str] | None = None,
467
+ ) -> dict[str, Any]:
1120
468
  """
1121
- Retrieves detailed information for a specific channel within a Microsoft Teams team, identified by both team and channel IDs. Optional parameters can select specific properties or expand related entities in the response, distinguishing it from list_channels_for_team, which retrieves a collection of channels.
469
+ Retrieve the default General channel of a team.
470
+ Supported OData parameters:
471
+ - $select: Select specific properties to return.
472
+ - $expand: Expand related entities.
1122
473
 
1123
474
  Args:
1124
- team_id (string): team-id
1125
- channel_id (string): channel-id
1126
- select (array): Select properties to be returned
1127
- expand (array): Expand related entities
475
+ team_id (string): The unique identifier of the team.
476
+ select (array): Select properties to be returned.
477
+ expand (array): Expand related entities.
1128
478
 
1129
479
  Returns:
1130
- Any: Retrieved navigation property
480
+ dict[str, Any]: Retrieved channel entity.
1131
481
 
1132
482
  Raises:
1133
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
483
+ HTTPStatusError: If the API request fails.
1134
484
 
1135
485
  Tags:
1136
- teams.channel
486
+ teams.channel, read
1137
487
  """
1138
488
  if team_id is None:
1139
489
  raise ValueError("Missing required parameter 'team-id'.")
1140
- if channel_id is None:
1141
- raise ValueError("Missing required parameter 'channel-id'.")
1142
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}"
1143
- query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
490
+
491
+ url = f"{self.base_url}/teams/{team_id}/primaryChannel"
492
+
493
+ # Helper to format list params
494
+ def fmt(val):
495
+ return ",".join(val) if isinstance(val, list) else val
496
+
497
+ query_params = {
498
+ k: fmt(v)
499
+ for k, v in [
500
+ ("$select", select),
501
+ ("$expand", expand),
502
+ ]
503
+ if v is not None
504
+ }
505
+
1144
506
  response = await self._aget(url, params=query_params)
1145
507
  return self._handle_response(response)
1146
508
 
1147
- async def update_channel_message(
509
+ async def send_channel_message(
1148
510
  self,
1149
511
  team_id: str,
1150
512
  channel_id: str,
1151
- chatMessage_id: str,
1152
- id: str | None = None,
1153
- attachments: list[dict[str, dict[str, Any]]] | None = None,
1154
- body: dict[str, dict[str, Any]] | None = None,
1155
- channelIdentity: dict[str, dict[str, Any]] | None = None,
1156
- chatId: str | None = None,
1157
- createdDateTime: str | None = None,
1158
- deletedDateTime: str | None = None,
1159
- etag: str | None = None,
1160
- eventDetail: dict[str, dict[str, Any]] | None = None,
1161
- from_: Any | None = None,
1162
- importance: str | None = None,
1163
- lastEditedDateTime: str | None = None,
1164
- lastModifiedDateTime: str | None = None,
1165
- locale: str | None = None,
1166
- mentions: list[dict[str, dict[str, Any]]] | None = None,
1167
- messageHistory: list[dict[str, dict[str, Any]]] | None = None,
1168
- messageType: str | None = None,
1169
- policyViolation: dict[str, dict[str, Any]] | None = None,
1170
- reactions: list[dict[str, dict[str, Any]]] | None = None,
1171
- replyToId: str | None = None,
1172
- subject: str | None = None,
1173
- summary: str | None = None,
1174
- webUrl: str | None = None,
1175
- hostedContents: list[Any] | None = None,
1176
- replies: list[Any] | None = None,
1177
- ) -> Any:
513
+ content: str,
514
+ ) -> dict[str, Any]:
1178
515
  """
1179
- Updates an existing message within a Microsoft Teams channel, identified by team, channel, and message IDs. This function modifies the original message's properties, like its body, via a PATCH request, distinguishing it from functions that create new messages or update replies.
516
+ Posts a new message to a specific channel in a team.
1180
517
 
1181
518
  Args:
1182
- team_id (string): team-id
1183
- channel_id (string): channel-id
1184
- chatMessage_id (string): chatMessage-id
1185
- id (string): The unique identifier for an entity. Read-only.
1186
- attachments (array): References to attached objects like files, tabs, meetings etc.
1187
- body (object): body
1188
- channelIdentity (object): channelIdentity
1189
- chatId (string): If the message was sent in a chat, represents the identity of the chat.
1190
- createdDateTime (string): Timestamp of when the chat message was created.
1191
- deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
1192
- etag (string): Read-only. Version number of the chat message.
1193
- eventDetail (object): eventDetail
1194
- from_ (string): from
1195
- importance (string): importance
1196
- lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
1197
- lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
1198
- locale (string): Locale of the chat message set by the client. Always set to en-us.
1199
- mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
1200
- messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
1201
- messageType (string): messageType
1202
- policyViolation (object): policyViolation
1203
- reactions (array): Reactions for this chat message (for example, Like).
1204
- replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
1205
- subject (string): The subject of the chat message, in plaintext.
1206
- summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
1207
- webUrl (string): Read-only. Link to the message in Microsoft Teams.
1208
- hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
1209
- replies (array): Replies for a specified message. Supports $expand for channel messages.
519
+ team_id (string): The unique identifier of the team.
520
+ channel_id (string): The unique identifier of the channel.
521
+ content (string): The message content to send (plain text or HTML).
1210
522
 
1211
523
  Returns:
1212
- Any: Success
524
+ dict[str, Any]: A dictionary containing the API response for the sent message, including its ID.
1213
525
 
1214
526
  Raises:
1215
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
527
+ HTTPStatusError: If the API request fails.
1216
528
 
1217
529
  Tags:
1218
- teams.channel
530
+ teams.channel, channel.message, create, send
1219
531
  """
1220
532
  if team_id is None:
1221
533
  raise ValueError("Missing required parameter 'team-id'.")
1222
534
  if channel_id is None:
1223
535
  raise ValueError("Missing required parameter 'channel-id'.")
1224
- if chatMessage_id is None:
1225
- raise ValueError("Missing required parameter 'chatMessage-id'.")
1226
- request_body_data = None
1227
- request_body_data = {
1228
- "id": id,
1229
- "attachments": attachments,
1230
- "body": body,
1231
- "channelIdentity": channelIdentity,
1232
- "chatId": chatId,
1233
- "createdDateTime": createdDateTime,
1234
- "deletedDateTime": deletedDateTime,
1235
- "etag": etag,
1236
- "eventDetail": eventDetail,
1237
- "from": from_,
1238
- "importance": importance,
1239
- "lastEditedDateTime": lastEditedDateTime,
1240
- "lastModifiedDateTime": lastModifiedDateTime,
1241
- "locale": locale,
1242
- "mentions": mentions,
1243
- "messageHistory": messageHistory,
1244
- "messageType": messageType,
1245
- "policyViolation": policyViolation,
1246
- "reactions": reactions,
1247
- "replyToId": replyToId,
1248
- "subject": subject,
1249
- "summary": summary,
1250
- "webUrl": webUrl,
1251
- "hostedContents": hostedContents,
1252
- "replies": replies,
1253
- }
1254
- request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1255
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{chatMessage_id}"
1256
- query_params = {}
1257
- response = self._patch(url, data=request_body_data, params=query_params)
536
+
537
+ url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages"
538
+ payload = {"body": {"content": content}}
539
+
540
+ response = await self._apost(url, data=payload)
1258
541
  return self._handle_response(response)
1259
542
 
1260
- async def update_channel_message_reply(
543
+ async def reply_to_channel_message(
1261
544
  self,
1262
545
  team_id: str,
1263
546
  channel_id: str,
1264
- chatMessage_id: str,
1265
- chatMessage_id1: str,
1266
- id: str | None = None,
1267
- attachments: list[dict[str, dict[str, Any]]] | None = None,
1268
- body: dict[str, dict[str, Any]] | None = None,
1269
- channelIdentity: dict[str, dict[str, Any]] | None = None,
1270
- chatId: str | None = None,
1271
- createdDateTime: str | None = None,
1272
- deletedDateTime: str | None = None,
1273
- etag: str | None = None,
1274
- eventDetail: dict[str, dict[str, Any]] | None = None,
1275
- from_: Any | None = None,
1276
- importance: str | None = None,
1277
- lastEditedDateTime: str | None = None,
1278
- lastModifiedDateTime: str | None = None,
1279
- locale: str | None = None,
1280
- mentions: list[dict[str, dict[str, Any]]] | None = None,
1281
- messageHistory: list[dict[str, dict[str, Any]]] | None = None,
1282
- messageType: str | None = None,
1283
- policyViolation: dict[str, dict[str, Any]] | None = None,
1284
- reactions: list[dict[str, dict[str, Any]]] | None = None,
1285
- replyToId: str | None = None,
1286
- subject: str | None = None,
1287
- summary: str | None = None,
1288
- webUrl: str | None = None,
1289
- hostedContents: list[Any] | None = None,
1290
- replies: list[Any] | None = None,
1291
- ) -> Any:
547
+ message_id: str,
548
+ content: str,
549
+ ) -> dict[str, Any]:
1292
550
  """
1293
- Updates an existing reply to a specific message within a Microsoft Teams channel. It identifies the target reply using team, channel, parent message, and reply IDs, modifying its properties (e.g., body content, attachments) via a PATCH request.
551
+ Sends a reply to an existing message in a channel.
1294
552
 
1295
553
  Args:
1296
- team_id (string): team-id
1297
- channel_id (string): channel-id
1298
- chatMessage_id (string): chatMessage-id
1299
- chatMessage_id1 (string): chatMessage-id1
1300
- id (string): The unique identifier for an entity. Read-only.
1301
- attachments (array): References to attached objects like files, tabs, meetings etc.
1302
- body (object): body
1303
- channelIdentity (object): channelIdentity
1304
- chatId (string): If the message was sent in a chat, represents the identity of the chat.
1305
- createdDateTime (string): Timestamp of when the chat message was created.
1306
- deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
1307
- etag (string): Read-only. Version number of the chat message.
1308
- eventDetail (object): eventDetail
1309
- from_ (string): from
1310
- importance (string): importance
1311
- lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
1312
- lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
1313
- locale (string): Locale of the chat message set by the client. Always set to en-us.
1314
- mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
1315
- messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
1316
- messageType (string): messageType
1317
- policyViolation (object): policyViolation
1318
- reactions (array): Reactions for this chat message (for example, Like).
1319
- replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
1320
- subject (string): The subject of the chat message, in plaintext.
1321
- summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
1322
- webUrl (string): Read-only. Link to the message in Microsoft Teams.
1323
- hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
1324
- replies (array): Replies for a specified message. Supports $expand for channel messages.
554
+ team_id (string): The unique identifier of the team.
555
+ channel_id (string): The unique identifier of the channel.
556
+ message_id (string): The unique identifier of the message to reply to.
557
+ content (string): The reply content to send (plain text or HTML).
1325
558
 
1326
559
  Returns:
1327
- Any: Success
560
+ dict[str, Any]: A dictionary containing the API response for the created reply.
1328
561
 
1329
562
  Raises:
1330
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
563
+ HTTPStatusError: If the API request fails.
1331
564
 
1332
565
  Tags:
1333
- teams.channel
566
+ teams.channel, channel.message, reply, create, send
1334
567
  """
1335
568
  if team_id is None:
1336
569
  raise ValueError("Missing required parameter 'team-id'.")
1337
570
  if channel_id is None:
1338
571
  raise ValueError("Missing required parameter 'channel-id'.")
1339
- if chatMessage_id is None:
1340
- raise ValueError("Missing required parameter 'chatMessage-id'.")
1341
- if chatMessage_id1 is None:
1342
- raise ValueError("Missing required parameter 'chatMessage-id1'.")
1343
- request_body_data = None
1344
- request_body_data = {
1345
- "id": id,
1346
- "attachments": attachments,
1347
- "body": body,
1348
- "channelIdentity": channelIdentity,
1349
- "chatId": chatId,
1350
- "createdDateTime": createdDateTime,
1351
- "deletedDateTime": deletedDateTime,
1352
- "etag": etag,
1353
- "eventDetail": eventDetail,
1354
- "from": from_,
1355
- "importance": importance,
1356
- "lastEditedDateTime": lastEditedDateTime,
1357
- "lastModifiedDateTime": lastModifiedDateTime,
1358
- "locale": locale,
1359
- "mentions": mentions,
1360
- "messageHistory": messageHistory,
1361
- "messageType": messageType,
1362
- "policyViolation": policyViolation,
1363
- "reactions": reactions,
1364
- "replyToId": replyToId,
1365
- "subject": subject,
1366
- "summary": summary,
1367
- "webUrl": webUrl,
1368
- "hostedContents": hostedContents,
1369
- "replies": replies,
1370
- }
1371
- request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1372
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{chatMessage_id}/replies/{chatMessage_id1}"
1373
- query_params = {}
1374
- response = self._patch(url, data=request_body_data, params=query_params)
572
+ if message_id is None:
573
+ raise ValueError("Missing required parameter 'message-id'.")
574
+
575
+ url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{message_id}/replies"
576
+ payload = {"body": {"content": content}}
577
+
578
+ response = await self._apost(url, data=payload)
1375
579
  return self._handle_response(response)
1376
580
 
1377
- async def list_channel_tabs(
581
+ async def list_pinned_chat_messages(
1378
582
  self,
1379
- team_id: str,
1380
- channel_id: str,
1381
- top: int | None = None,
1382
- skip: int | None = None,
1383
- search: str | None = None,
1384
- filter: str | None = None,
1385
- count: bool | None = None,
1386
- orderby: list[str] | None = None,
1387
- select: list[str] | None = None,
583
+ chat_id: str,
1388
584
  expand: list[str] | None = None,
1389
585
  ) -> dict[str, Any]:
1390
586
  """
1391
- Retrieves a collection of tabs from a specified channel within a Microsoft Teams team. Unlike `get_channel_tab_details`, which fetches a single tab, this function lists all tabs and supports advanced OData query parameters for filtering, sorting, and pagination of the entire collection.
587
+ Get a list of pinned messages in a chat.
588
+ Supported OData parameters:
589
+ - $expand: Expand related entities (e.g., 'message').
1392
590
 
1393
591
  Args:
1394
- team_id (string): team-id
1395
- channel_id (string): channel-id
1396
- top (integer): Show only the first n items Example: '50'.
1397
- skip (integer): Skip the first n items
1398
- search (string): Search items by search phrases
1399
- filter (string): Filter items by property values
1400
- count (boolean): Include count of items
1401
- orderby (array): Order items by property values
1402
- select (array): Select properties to be returned
1403
- expand (array): Expand related entities
592
+ chat_id (string): The unique identifier of the chat.
593
+ expand (array): Expand related entities.
1404
594
 
1405
595
  Returns:
1406
- dict[str, Any]: Retrieved collection
596
+ dict[str, Any]: Retrieved collection of pinned messages.
1407
597
 
1408
598
  Raises:
1409
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
599
+ HTTPStatusError: If the API request fails.
1410
600
 
1411
601
  Tags:
1412
- teams.channel
602
+ teams.chat, pinned_message, list, read
1413
603
  """
1414
- if team_id is None:
1415
- raise ValueError("Missing required parameter 'team-id'.")
1416
- if channel_id is None:
1417
- raise ValueError("Missing required parameter 'channel-id'.")
1418
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs"
604
+ if chat_id is None:
605
+ raise ValueError("Missing required parameter 'chat-id'.")
606
+
607
+ url = f"{self.base_url}/chats/{chat_id}/pinnedMessages"
608
+
609
+ # Helper to format list params
610
+ def fmt(val):
611
+ return ",".join(val) if isinstance(val, list) else val
612
+
1419
613
  query_params = {
1420
- k: v
614
+ k: fmt(v)
1421
615
  for k, v in [
1422
- ("$top", top),
1423
- ("$skip", skip),
1424
- ("$search", search),
1425
- ("$filter", filter),
1426
- ("$count", count),
1427
- ("$orderby", orderby),
1428
- ("$select", select),
1429
616
  ("$expand", expand),
1430
617
  ]
1431
618
  if v is not None
1432
619
  }
620
+
1433
621
  response = await self._aget(url, params=query_params)
1434
622
  return self._handle_response(response)
1435
623
 
1436
- async def create_channel_tab(
624
+ async def pin_chat_message(
1437
625
  self,
1438
- team_id: str,
1439
- channel_id: str,
1440
- id: str | None = None,
1441
- configuration: dict[str, dict[str, Any]] | None = None,
1442
- displayName: str | None = None,
1443
- webUrl: str | None = None,
1444
- teamsApp: Any | None = None,
1445
- ) -> Any:
626
+ chat_id: str,
627
+ message_id: str,
628
+ ) -> dict[str, Any]:
1446
629
  """
1447
- Creates a new tab in a specified Microsoft Teams channel using team and channel IDs. This function configures the tab's initial properties, such as display name and application, distinguishing it from functions that list (`list_channel_tabs`) or modify (`update_channel_tab`) existing tabs.
630
+ Pin a message in a chat.
1448
631
 
1449
632
  Args:
1450
- team_id (string): team-id
1451
- channel_id (string): channel-id
1452
- id (string): The unique identifier for an entity. Read-only.
1453
- configuration (object): configuration
1454
- displayName (string): Name of the tab.
1455
- webUrl (string): Deep link URL of the tab instance. Read only.
1456
- teamsApp (string): teamsApp
633
+ chat_id (string): The unique identifier of the chat.
634
+ message_id (string): The unique identifier of the message to pin.
1457
635
 
1458
636
  Returns:
1459
- Any: Created navigation property.
637
+ dict[str, Any]: A dictionary containing the API response for the pinned message.
1460
638
 
1461
639
  Raises:
1462
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
640
+ HTTPStatusError: If the API request fails.
1463
641
 
1464
642
  Tags:
1465
- teams.channel
643
+ teams.chat, pinned_message, create, pin
1466
644
  """
1467
- if team_id is None:
1468
- raise ValueError("Missing required parameter 'team-id'.")
1469
- if channel_id is None:
1470
- raise ValueError("Missing required parameter 'channel-id'.")
1471
- request_body_data = None
1472
- request_body_data = {"id": id, "configuration": configuration, "displayName": displayName, "webUrl": webUrl, "teamsApp": teamsApp}
1473
- request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1474
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs"
1475
- query_params = {}
1476
- response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
645
+ if chat_id is None:
646
+ raise ValueError("Missing required parameter 'chat-id'.")
647
+ if message_id is None:
648
+ raise ValueError("Missing required parameter 'message-id'.")
649
+
650
+ url = f"{self.base_url}/chats/{chat_id}/pinnedMessages"
651
+
652
+ # The API requires a specific OData bind format for the message
653
+ payload = {
654
+ "message@odata.bind": f"https://graph.microsoft.com/v1.0/chats/{chat_id}/messages/{message_id}"
655
+ }
656
+
657
+ response = await self._apost(url, data=payload)
1477
658
  return self._handle_response(response)
1478
659
 
1479
- async def get_channel_tab_details(
1480
- self, team_id: str, channel_id: str, teamsTab_id: str, select: list[str] | None = None, expand: list[str] | None = None
1481
- ) -> Any:
660
+ async def unpin_chat_message(
661
+ self,
662
+ chat_id: str,
663
+ pinned_chat_message_id: str,
664
+ ) -> dict[str, Any]:
1482
665
  """
1483
- Fetches properties for a single tab within a specific Microsoft Teams channel, identified by its team, channel, and tab IDs. Unlike `list_channel_tabs` which gets all tabs, this targets a specific one, with options to select fields or expand related entities in the response.
666
+ Unpin a message from a chat.
1484
667
 
1485
668
  Args:
1486
- team_id (string): team-id
1487
- channel_id (string): channel-id
1488
- teamsTab_id (string): teamsTab-id
1489
- select (array): Select properties to be returned
1490
- expand (array): Expand related entities
669
+ chat_id (string): The unique identifier of the chat.
670
+ pinned_chat_message_id (string): The unique identifier of the pinned message (not the message ID itself).
1491
671
 
1492
672
  Returns:
1493
- Any: Retrieved navigation property
673
+ dict[str, Any]: A dictionary containing the API response (usually empty for 204).
1494
674
 
1495
675
  Raises:
1496
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
676
+ HTTPStatusError: If the API request fails.
1497
677
 
1498
678
  Tags:
1499
- teams.channel
679
+ teams.chat, pinned_message, delete, unpin
1500
680
  """
1501
- if team_id is None:
1502
- raise ValueError("Missing required parameter 'team-id'.")
1503
- if channel_id is None:
1504
- raise ValueError("Missing required parameter 'channel-id'.")
1505
- if teamsTab_id is None:
1506
- raise ValueError("Missing required parameter 'teamsTab-id'.")
1507
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs/{teamsTab_id}"
1508
- query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
1509
- response = await self._aget(url, params=query_params)
681
+ if chat_id is None:
682
+ raise ValueError("Missing required parameter 'chat-id'.")
683
+ if pinned_chat_message_id is None:
684
+ raise ValueError("Missing required parameter 'pinned-chat-message-id'.")
685
+
686
+ url = f"{self.base_url}/chats/{chat_id}/pinnedMessages/{pinned_chat_message_id}"
687
+
688
+ response = await self._adelete(url)
689
+ # DELETE 204 returns no content, handle gracefully
690
+ if response.status_code == 204:
691
+ return {"status": "success", "message": "Message unpinned successfully."}
1510
692
  return self._handle_response(response)
1511
693
 
1512
- async def update_channel_tab(
694
+ # Teams
695
+
696
+ async def create_team(
1513
697
  self,
1514
- team_id: str,
1515
- channel_id: str,
1516
- teamsTab_id: str,
1517
- id: str | None = None,
1518
- configuration: dict[str, dict[str, Any]] | None = None,
1519
- displayName: str | None = None,
1520
- webUrl: str | None = None,
1521
- teamsApp: Any | None = None,
1522
- ) -> Any:
698
+ display_name: str,
699
+ description: str,
700
+ ) -> dict[str, Any]:
1523
701
  """
1524
- Modifies properties of an existing tab within a specific Microsoft Teams channel. It uses the team, channel, and tab IDs to target the tab, allowing for partial updates to its configuration or display name via a PATCH request, differentiating it from tab creation or deletion functions.
702
+ Create a new team.
703
+ Uses the 'standard' template by default.
1525
704
 
1526
705
  Args:
1527
- team_id (string): team-id
1528
- channel_id (string): channel-id
1529
- teamsTab_id (string): teamsTab-id
1530
- id (string): The unique identifier for an entity. Read-only.
1531
- configuration (object): configuration
1532
- displayName (string): Name of the tab.
1533
- webUrl (string): Deep link URL of the tab instance. Read only.
1534
- teamsApp (string): teamsApp
706
+ display_name (string): The name of the team.
707
+ description (string): The description of the team.
1535
708
 
1536
709
  Returns:
1537
- Any: Success
710
+ dict[str, Any]: A dictionary containing the API response (e.g., location header for the async operation).
1538
711
 
1539
712
  Raises:
1540
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
713
+ HTTPStatusError: If the API request fails.
1541
714
 
1542
715
  Tags:
1543
- teams.channel
716
+ teams.team, create, provision
1544
717
  """
1545
- if team_id is None:
1546
- raise ValueError("Missing required parameter 'team-id'.")
1547
- if channel_id is None:
1548
- raise ValueError("Missing required parameter 'channel-id'.")
1549
- if teamsTab_id is None:
1550
- raise ValueError("Missing required parameter 'teamsTab-id'.")
1551
- request_body_data = None
1552
- request_body_data = {"id": id, "configuration": configuration, "displayName": displayName, "webUrl": webUrl, "teamsApp": teamsApp}
1553
- request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1554
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs/{teamsTab_id}"
1555
- query_params = {}
1556
- response = self._patch(url, data=request_body_data, params=query_params)
718
+ if display_name is None:
719
+ raise ValueError("Missing required parameter 'display-name'.")
720
+ if description is None:
721
+ raise ValueError("Missing required parameter 'description'.")
722
+
723
+ url = f"{self.base_url}/teams"
724
+
725
+ payload = {
726
+ "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
727
+ "displayName": display_name,
728
+ "description": description
729
+ }
730
+
731
+ response = await self._apost(url, data=payload)
732
+
733
+ # 202 Accepted means it's an async operation.
734
+ # The Location header contains the URL to check status.
735
+ if response.status_code == 202:
736
+ return {
737
+ "status": "accepted",
738
+ "operation_location": response.headers.get("Location"),
739
+ "message": "Team creation initiated. Check operation_location for status."
740
+ }
741
+
1557
742
  return self._handle_response(response)
1558
743
 
1559
- async def delete_channel_tab(self, team_id: str, channel_id: str, teamsTab_id: str) -> Any:
744
+ async def get_team(
745
+ self,
746
+ team_id: str,
747
+ select: list[str] | None = None,
748
+ expand: list[str] | None = None,
749
+ ) -> dict[str, Any]:
1560
750
  """
1561
- Permanently removes a specific tab from a Microsoft Teams channel using its unique ID, along with the parent team and channel IDs. This function is the destructive counterpart to `create_channel_tab`, designed to delete a tab rather than create, list, or update one.
751
+ Retrieve a specific team's details.
752
+ Supported OData parameters:
753
+ - $select: Select specific properties.
754
+ - $expand: Expand related entities.
1562
755
 
1563
756
  Args:
1564
- team_id (string): team-id
1565
- channel_id (string): channel-id
1566
- teamsTab_id (string): teamsTab-id
757
+ team_id (string): The unique identifier of the team.
758
+ select (array): Select specific properties.
759
+ expand (array): Expand related entities.
1567
760
 
1568
761
  Returns:
1569
- Any: Success
762
+ dict[str, Any]: The team resource.
1570
763
 
1571
764
  Raises:
1572
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
765
+ HTTPStatusError: If the API request fails.
1573
766
 
1574
767
  Tags:
1575
- teams.channel
768
+ teams.team, read, get
1576
769
  """
1577
770
  if team_id is None:
1578
771
  raise ValueError("Missing required parameter 'team-id'.")
1579
- if channel_id is None:
1580
- raise ValueError("Missing required parameter 'channel-id'.")
1581
- if teamsTab_id is None:
1582
- raise ValueError("Missing required parameter 'teamsTab-id'.")
1583
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs/{teamsTab_id}"
1584
- query_params = {}
1585
- response = await self._adelete(url, params=query_params)
1586
- return self._handle_response(response)
1587
-
1588
- async def get_primary_team_channel(self, team_id: str, select: list[str] | None = None, expand: list[str] | None = None) -> Any:
1589
- """
1590
- Retrieves the primary channel (usually 'General') for a specified team using its ID. Unlike `get_channel_details`, this function directly accesses the team's default channel without requiring a specific channel ID. Optional parameters can select or expand properties in the returned data.
1591
772
 
1592
- Args:
1593
- team_id (string): team-id
1594
- select (array): Select properties to be returned
1595
- expand (array): Expand related entities
773
+ url = f"{self.base_url}/teams/{team_id}"
1596
774
 
1597
- Returns:
1598
- Any: Retrieved navigation property
775
+ # Helper to format list params
776
+ def fmt(val):
777
+ return ",".join(val) if isinstance(val, list) else val
1599
778
 
1600
- Raises:
1601
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
779
+ query_params = {
780
+ k: fmt(v)
781
+ for k, v in [
782
+ ("$select", select),
783
+ ("$expand", expand),
784
+ ]
785
+ if v is not None
786
+ }
1602
787
 
1603
- Tags:
1604
- teams.channel
1605
- """
1606
- if team_id is None:
1607
- raise ValueError("Missing required parameter 'team-id'.")
1608
- url = f"{self.base_url}/teams/{team_id}/primaryChannel"
1609
- query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
1610
788
  response = await self._aget(url, params=query_params)
1611
789
  return self._handle_response(response)
1612
790
 
1613
- async def list_user_installed_apps(
791
+ async def list_joined_teams(
1614
792
  self,
1615
- user_id: str,
1616
- top: int | None = None,
1617
- skip: int | None = None,
1618
- search: str | None = None,
1619
- filter: str | None = None,
1620
- count: bool | None = None,
1621
- orderby: list[str] | None = None,
1622
- select: list[str] | None = None,
1623
- expand: list[str] | None = None,
1624
793
  ) -> dict[str, Any]:
1625
794
  """
1626
- Retrieves applications installed in a user's personal Microsoft Teams scope, identified by their ID. Unlike `list_installed_chat_apps` which targets chat installations, this focuses on the user's scope. It supports optional OData parameters for filtering, sorting, and pagination to customize the returned app collection.
1627
-
1628
- Args:
1629
- user_id (string): user-id
1630
- top (integer): Show only the first n items Example: '50'.
1631
- skip (integer): Skip the first n items
1632
- search (string): Search items by search phrases
1633
- filter (string): Filter items by property values
1634
- count (boolean): Include count of items
1635
- orderby (array): Order items by property values
1636
- select (array): Select properties to be returned
1637
- expand (array): Expand related entities
795
+ List the teams that the user is a direct member of.
796
+ Note: This endpoint does not support OData query parameters.
797
+ It returns a subset of properties (id, displayName, description, isArchived, tenantId) by default.
1638
798
 
1639
799
  Returns:
1640
- dict[str, Any]: Retrieved collection
800
+ dict[str, Any]: A dictionary containing the list of teams.
1641
801
 
1642
802
  Raises:
1643
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
1644
-
803
+ HTTPStatusError: If the API request fails.
804
+
1645
805
  Tags:
1646
- users.userTeamwork
806
+ teams.team, list, read, joined
1647
807
  """
1648
- if user_id is None:
1649
- raise ValueError("Missing required parameter 'user-id'.")
1650
- url = f"{self.base_url}/users/{user_id}/teamwork/installedApps"
1651
- query_params = {
1652
- k: v
1653
- for k, v in [
1654
- ("$top", top),
1655
- ("$skip", skip),
1656
- ("$search", search),
1657
- ("$filter", filter),
1658
- ("$count", count),
1659
- ("$orderby", orderby),
1660
- ("$select", select),
1661
- ("$expand", expand),
1662
- ]
1663
- if v is not None
1664
- }
1665
- response = await self._aget(url, params=query_params)
808
+ url = f"{self.base_url}/me/joinedTeams"
809
+
810
+ response = await self._aget(url)
1666
811
  return self._handle_response(response)
1667
812
 
1668
813
  def list_tools(self):
1669
814
  return [
815
+ self.get_me,
1670
816
  self.get_user_chats,
1671
- self.get_joined_teams,
1672
- self.list_channels_for_team,
1673
- self.send_chat_message,
1674
- self.send_channel_message,
1675
- self.reply_to_channel_message,
1676
817
  self.create_chat,
1677
818
  self.get_chat_details,
1678
819
  self.update_chat_details,
1679
- self.list_installed_chat_apps,
1680
820
  self.list_chat_members,
1681
- self.add_member_to_chat,
1682
821
  self.get_chat_member,
1683
- self.delete_chat_member,
1684
822
  self.list_chat_messages,
1685
823
  self.get_chat_message,
1686
- self.list_chat_message_replies,
1687
- self.reply_to_chat_message,
1688
- self.get_chat_reply_details,
1689
- self.create_team_from_group,
824
+ self.send_chat_message,
825
+ self.list_all_channels,
826
+ self.get_channel,
827
+ self.get_primary_channel,
828
+ self.send_channel_message,
829
+ self.reply_to_channel_message,
830
+ self.list_pinned_chat_messages,
831
+ self.pin_chat_message,
832
+ self.unpin_chat_message,
1690
833
  self.create_team,
1691
- self.get_channel_details,
1692
- self.update_channel_message,
1693
- self.update_channel_message_reply,
1694
- self.list_channel_tabs,
1695
- self.create_channel_tab,
1696
- self.get_channel_tab_details,
1697
- self.update_channel_tab,
1698
- self.delete_channel_tab,
1699
- self.get_primary_team_channel,
1700
- self.list_user_installed_apps,
834
+ self.get_team,
835
+ self.list_joined_teams,
1701
836
  ]