# Tencent TRTC MCP

> Tencent TRTC connects your AI agent directly to a massive real-time video communication engine. It lets you automatically manage live streaming rooms, archive high-definition recordings, and analyze granular call quality metrics from any workflow.

## Overview
- **Category:** industry-titans
- **Price:** Free
- **Tags:** real-time-communication, live-streaming, video-calls, session-management, cloud-recording, telemetry

## Description

You're hooking your AI agent up to a massive real-time video comms engine from Tencent TRTC. This isn't just for basic calls; you use it when y’all need automated control over live streams, detailed metrics on call health, and professional archiving capabilities. It lets your agent manage everything from who's in the room to combining multiple feeds into one single output.

**Monitoring Call Performance and Room Status**

When you run into a flaky connection or just need an audit trail, you can assess the session metrics using `describe_call_detail_info`. This tool pulls detailed data points about the live video call's quality and performance—you'll get specifics on things like frame drops and bandwidth usage. For a quick status check, you use `describe_room_info` to pull current details for any specific TRTC room session, figuring out if it's active or when it was even created.

If your agent needs to know who’s actually on the line, you call `describe_user_info`, passing in a known call session ID and getting back a list of all unique participant IDs. If you need a high-level overview for billing or resource planning, you pull aggregated service data by invoking `describe_trtc_usage` to see overall usage patterns and volume statistics.

**Controlling User Presence in Rooms**

Your agent has full control over who's talking shop. If someone needs to be kicked out—whether they’re spamming or the meeting is done—you can force termination of an entire session using `dismiss_room`, which immediately disconnects every user in that TRTC room. You don't have to dismiss everyone, though. To target specific people, you use `remove_user` by providing a user’s ID and the active room context. If you know the string-based room ID but not individual user IDs, you can manage multiple exits at once calling `remove_user_by_str_room_id`. These tools let your agent surgically control participant lists in real time.

**Managing Video Streams and Archiving Content**

If y’all need proof of what happened, or if the content is valuable enough to keep, you manage stream archiving. To start recording every video output and activity happening in an active room, you run `start_cloud_recording`. When the session wraps up, you use `stop_cloud_recording` to halt that specific cloud task. For advanced mixing—say, when three different people are talking but you only want one clean feed for a presentation—you initiate the process with `start_mcu_mix`, which starts multi-channel unit (MCU) mixing and combines multiple video feeds into a single stream source. When the mix is done, you stop it by calling `stop_mcu_mix`, freeing up those resources.

**How It Works Under the Hood**

To get started, your agent needs credentials: **Tencent SecretId**, **SecretKey**, and **SdkAppId**. You're meant to inject these into your LLM logic so it treats this server like an automated stream backend. Once connected, your agent can invoke specific tools—like `remove_user` or `start_cloud_recording`—to execute complex video operations you otherwise couldn't touch.

## Tools

### describe_call_detail_info
Retrieves detailed metrics about the quality and performance of an active video call session.

### describe_room_info
Gets current details for a specific TRTC room session, like its status or creation time.

### describe_trtc_usage
Pulls aggregated statistics showing overall usage patterns and volume of the TRTC service.

### describe_user_info
Queries a list of active participants for a known call session using their unique IDs.

### dismiss_room
Forcefully terminates an entire TRTC room session, disconnecting all users immediately.

### remove_user
Removes a specific user from a TRTC room given their ID and the room context.

### remove_user_by_str_room_id
Disconnects one or more users from a room using its string-based ID for targeted removal.

### start_cloud_recording
Initiates the process of recording all video output and activity in an active TRTC room to cloud storage.

### start_mcu_mix
Begins multi-channel unit (MCU) mixing, preparing a combined stream from several sources within the room.

### stop_cloud_recording
Halts an ongoing cloud recording task for a specific TRTC room session.

### stop_mcu_mix
Stops the multi-channel unit mixing process for a given room, freeing up resources.

## Prompt Examples

**Prompt:** 
```
Kick user 9901 from room ID 3084.
```

**Response:** 
```
The user `9901` has been disconnected from the TRTC session and can no longer publish streams in room 3084.
```

**Prompt:** 
```
Check the health and users attached to room TestRoomA.
```

**Response:** 
```
Room TestRoomA is currently active online. I've pulled the active participants list, indicating 3 primary stream publishers are broadcasting successfully with 0 frame drops reported.
```

## Capabilities

### Monitor Live Call Metrics
Get real-time data points, like frame drops and bandwidth metrics, for immediate call health assessment.

### Control User Presence in Rooms
Manage participant lists by querying who is in a session or removing specific users from active rooms.

### Manage Stream Archiving
Start and stop cloud recordings, allowing the agent to archive entire sessions automatically.

### Mix Video Streams (MCU)
Initiate or terminate Multi-Channel Unit (MCU) mixing, which combines multiple video feeds into one output stream.

### View Usage Statistics
Retrieve aggregated statistics on how the TRTC service has been used over time for billing or analysis purposes.

## Use Cases

### The Compliance Archive Trigger
A training session concludes. Instead of an employee having to manually hit 'record,' the agent detects the room leaving a certain state and immediately calls `start_cloud_recording`. This ensures zero-effort, automated archiving for legal compliance.

### The Lag Diagnosis
A client reports their video is choppy. The ops engineer asks the agent to run diagnostics. The agent uses `describe_call_detail_info` and immediately gets frame drop analytics, proving if the issue is local or network-wide.

### The Rogue User Cleanup
A moderator detects a user spamming the chat in a live broadcast. The agent doesn't wait for a human command; it uses `remove_user_by_str_room_id` to instantly disconnect the offending party, keeping the stream clean.

### The Resource Cleanup Flow
A multi-party collaboration meeting is finished. The agent executes a cleanup sequence: first `stop_mcu_mix`, then checks if recordings are active using `describe_room_info`, and finally calls `stop_cloud_recording` to free up storage.

## Benefits

- Analyze connection stability. Use `describe_call_detail_info` to read real-time call performance matrices, instantly pinpointing dropped frames or bandwidth bottlenecks.
- Automate compliance archiving. With `start_cloud_recording`, you can trigger full session recordings without manual intervention, ensuring every important meeting is saved.
- Maintain room order. If a user breaks rules, the agent executes `remove_user` or `dismiss_room`. These tools handle the cleanup instantly, keeping sessions clean.
- Manage complex streams efficiently. Start and stop mixing feeds using `start_mcu_mix` and `stop_mcu_mix`, allowing your workflow to dynamically adjust stream complexity.
- Audit usage automatically. The `describe_trtc_usage` tool gives you a historical view of service utilization, which is critical for cost tracking or capacity planning.

## How It Works

The bottom line is: you provide the credentials and the desired action; the MCP server handles all the secure connection logic to manage the video stream.

1. Subscribe to the server and gather your necessary credentials: Tencent SecretId, SecretKey, and SdkAppId.
2. Inject those three pieces of data into your AI agent's logic so it can connect to the video backend.
3. The agent calls a function—for example, `start_cloud_recording`—and the server executes the complex, stateful action.

## Frequently Asked Questions

**How do I stop a recording using start_cloud_recording?**
You use `stop_cloud_recording`. This tool requires knowing the active room session to halt the task. Always check the status first with `describe_room_info`.

**Can I kick a user from a call using remove_user?**
Yes, that's what it does. The agent calls `remove_user`, and the connection is severed immediately for the specified participant in that room.

**What if I need to analyze past usage data? Do I use describe_trtc_usage?**
Yes, run `describe_trtc_usage`. It pulls aggregated statistics. This is different from real-time metrics; this is for billing or high-level capacity planning.

**Do I need to call describe_user_info before removing a user?**
It's safer to use `describe_user_info` first. This confirms that the unique CommId you intend to remove is currently active and attached to the room.

**How do I check the overall status of a session using describe_room_info?**
The tool pulls high-level details about the room. You get things like its unique ID, creation time, and whether it is currently active or suspended.

**What specific metrics does describe_call_detail_info provide for quality assessment?**
It delivers granular stream health data. This includes precise measurements of packet loss rates, latency levels, and frame drop analytics in real time.

**How do I manage video transcoding and mixing using start_mcu_mix?**
You use this tool to process multiple incoming streams into a single output mix. Remember to call stop_mcu_mix when you are finished with the session.

**If I need to immediately end all activity in a room, what does dismiss_room do?**
It terminates the entire TRTC session instantly via its ID. This action removes every connected user and halts all associated streaming tasks for that room.

**Does this support Tencent Cloud API v3 signature?**
Yes! The MCP abstraction layer perfectly encapsulates and executes the TC3-HMAC-SHA256 signature algorithm natively so you don't have to code it. Just provide `SecretId` and `SecretKey` safely.