Merge pull request #6 from l1v0n1/main
Refactor: Tool Cleanup for Reliability and Compatibility
This commit is contained in:
commit
10ff5b79b0
2 changed files with 7 additions and 28 deletions
17
README.md
17
README.md
|
|
@ -41,7 +41,6 @@ This MCP server exposes a huge suite of Telegram tools. **Every major Telegram/T
|
||||||
- **create_group(title, user_ids)**: Create a new group
|
- **create_group(title, user_ids)**: Create a new group
|
||||||
- **create_channel(title, about, megagroup)**: Create a channel or supergroup
|
- **create_channel(title, about, megagroup)**: Create a channel or supergroup
|
||||||
- **edit_chat_title(chat_id, title)**: Change chat/group/channel title
|
- **edit_chat_title(chat_id, title)**: Change chat/group/channel title
|
||||||
- **edit_chat_photo(chat_id, file_path)**: Set chat/group/channel photo
|
|
||||||
- **delete_chat_photo(chat_id)**: Remove chat/group/channel photo
|
- **delete_chat_photo(chat_id)**: Remove chat/group/channel photo
|
||||||
- **leave_chat(chat_id)**: Leave a group or channel
|
- **leave_chat(chat_id)**: Leave a group or channel
|
||||||
- **get_participants(chat_id)**: List all participants
|
- **get_participants(chat_id)**: List all participants
|
||||||
|
|
@ -70,6 +69,7 @@ This MCP server exposes a huge suite of Telegram tools. **Every major Telegram/T
|
||||||
- **get_message_context(chat_id, message_id, context_size)**: Context around a message
|
- **get_message_context(chat_id, message_id, context_size)**: Context around a message
|
||||||
- **get_history(chat_id, limit)**: Full chat history
|
- **get_history(chat_id, limit)**: Full chat history
|
||||||
- **get_pinned_messages(chat_id)**: List pinned messages
|
- **get_pinned_messages(chat_id)**: List pinned messages
|
||||||
|
- **get_last_interaction(contact_id)**: Most recent message with a contact
|
||||||
|
|
||||||
### Contact Management
|
### Contact Management
|
||||||
- **list_contacts()**: List all contacts
|
- **list_contacts()**: List all contacts
|
||||||
|
|
@ -84,21 +84,15 @@ This MCP server exposes a huge suite of Telegram tools. **Every major Telegram/T
|
||||||
- **get_contact_ids()**: List all contact IDs
|
- **get_contact_ids()**: List all contact IDs
|
||||||
- **get_direct_chat_by_contact(contact_query)**: Find direct chat with a contact
|
- **get_direct_chat_by_contact(contact_query)**: Find direct chat with a contact
|
||||||
- **get_contact_chats(contact_id)**: List all chats with a contact
|
- **get_contact_chats(contact_id)**: List all chats with a contact
|
||||||
- **get_last_interaction(contact_id)**: Most recent message with a contact
|
|
||||||
|
|
||||||
### User & Profile
|
### User & Profile
|
||||||
- **get_me()**: Get your user info
|
- **get_me()**: Get your user info
|
||||||
- **update_profile(first_name, last_name, about)**: Update your profile
|
- **update_profile(first_name, last_name, about)**: Update your profile
|
||||||
- **set_profile_photo(file_path)**: Set your profile photo
|
|
||||||
- **delete_profile_photo()**: Remove your profile photo
|
- **delete_profile_photo()**: Remove your profile photo
|
||||||
- **get_user_photos(user_id, limit)**: Get a user's profile photos
|
- **get_user_photos(user_id, limit)**: Get a user's profile photos
|
||||||
- **get_user_status(user_id)**: Get a user's online status
|
- **get_user_status(user_id)**: Get a user's online status
|
||||||
|
|
||||||
### Media
|
### Media
|
||||||
- **send_file(chat_id, file_path, caption)**: Send a file
|
|
||||||
- **send_voice(chat_id, file_path)**: Send a voice message
|
|
||||||
- **download_media(chat_id, message_id, file_path)**: Download media
|
|
||||||
- **upload_file(file_path)**: Upload a file to Telegram servers
|
|
||||||
- **get_media_info(chat_id, message_id)**: Get info about media in a message
|
- **get_media_info(chat_id, message_id)**: Get info about media in a message
|
||||||
|
|
||||||
### Search & Discovery
|
### Search & Discovery
|
||||||
|
|
@ -108,9 +102,6 @@ This MCP server exposes a huge suite of Telegram tools. **Every major Telegram/T
|
||||||
|
|
||||||
### Stickers, GIFs, Bots
|
### Stickers, GIFs, Bots
|
||||||
- **get_sticker_sets()**: List sticker sets
|
- **get_sticker_sets()**: List sticker sets
|
||||||
- **send_sticker(chat_id, file_path)**: Send a sticker
|
|
||||||
- **get_gif_search(query, limit)**: Search for GIFs
|
|
||||||
- **send_gif(chat_id, gif_id)**: Send a GIF
|
|
||||||
- **get_bot_info(bot_username)**: Get info about a bot
|
- **get_bot_info(bot_username)**: Get info about a bot
|
||||||
- **set_bot_commands(bot_username, commands)**: Set bot commands (bot accounts only)
|
- **set_bot_commands(bot_username, commands)**: Set bot commands (bot accounts only)
|
||||||
|
|
||||||
|
|
@ -123,6 +114,12 @@ This MCP server exposes a huge suite of Telegram tools. **Every major Telegram/T
|
||||||
- **unarchive_chat(chat_id)**: Unarchive a chat
|
- **unarchive_chat(chat_id)**: Unarchive a chat
|
||||||
- **get_recent_actions(chat_id)**: Get recent admin actions
|
- **get_recent_actions(chat_id)**: Get recent admin actions
|
||||||
|
|
||||||
|
## Removed Functionality
|
||||||
|
|
||||||
|
Please note that tools requiring direct file path access on the server (`send_file`, `download_media`, `set_profile_photo`, `edit_chat_photo`, `send_voice`, `send_sticker`, `upload_file`) have been removed from `main.py`. This is due to limitations in the current MCP environment regarding handling file attachments and local file system paths.
|
||||||
|
|
||||||
|
Additionally, GIF-related tools (`get_gif_search`, `get_saved_gifs`, `send_gif`) have been removed due to ongoing issues with reliability in the Telethon library or Telegram API interactions.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📋 Requirements
|
## 📋 Requirements
|
||||||
|
|
|
||||||
18
main.py
18
main.py
|
|
@ -1990,24 +1990,6 @@ async def reply_to_message(chat_id: int, message_id: int, text: str) -> str:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mcp.tool()
|
|
||||||
async def upload_file(file_path: str) -> str:
|
|
||||||
"""
|
|
||||||
Upload a file to Telegram servers (returns file handle as string, not a file path).
|
|
||||||
Args:
|
|
||||||
file_path: Absolute path to the file to upload (must exist and be readable).
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
if not os.path.isfile(file_path):
|
|
||||||
return f"File not found: {file_path}"
|
|
||||||
if not os.access(file_path, os.R_OK):
|
|
||||||
return f"File is not readable: {file_path}"
|
|
||||||
file = await client.upload_file(file_path)
|
|
||||||
return str(file)
|
|
||||||
except Exception as e:
|
|
||||||
return log_and_format_error("upload_file", e, file_path=file_path)
|
|
||||||
|
|
||||||
|
|
||||||
@mcp.tool()
|
@mcp.tool()
|
||||||
async def get_media_info(chat_id: int, message_id: int) -> str:
|
async def get_media_info(chat_id: int, message_id: int) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue