Skip to content

MCP Tools Reference

These tools are available to AI assistants when using WeCom Bot MCP Server.

send_message

Send text or markdown messages to WeCom.

Parameters

ParameterTypeRequiredDescription
contentstringYesMessage content
msg_typestringNoMessage type: text (default) or markdown
mentioned_listarrayNoList of user IDs to @mention
mentioned_mobile_listarrayNoList of phone numbers to @mention
bot_idstringNoTarget bot ID (uses default if not specified)

Examples

Simple text message:

Send "Hello team!" to WeCom

Markdown message:

Send a markdown message to WeCom with the build status

With @mentions:

Send a reminder to WeCom and mention user1 and user2

To specific bot:

Send an alert to the alert bot: Server is down!

Response

json
{
  "status": "success",
  "message": "Message sent successfully",
  "bot_id": "default"
}

send_wecom_file

Send a file to WeCom.

Parameters

ParameterTypeRequiredDescription
file_pathstringYesPath to the file
bot_idstringNoTarget bot ID

Examples

Send a file:

Send the file /path/to/report.pdf to WeCom

Send to specific bot:

Send the build log to the CI bot

Response

json
{
  "status": "success",
  "message": "File sent successfully",
  "file_info": {
    "name": "report.pdf",
    "size": 1024
  }
}

Limitations

  • Maximum file size: 20MB
  • All file types are supported

send_wecom_image

Send an image to WeCom.

Parameters

ParameterTypeRequiredDescription
image_pathstringYesPath to image file or URL
bot_idstringNoTarget bot ID

Examples

Send local image:

Send the image /path/to/chart.png to WeCom

Send from URL:

Send this image to WeCom: https://example.com/image.png

Response

json
{
  "status": "success",
  "message": "Image sent successfully",
  "image_info": {
    "format": "png",
    "size": 2048
  }
}

Limitations

  • Maximum size: 2MB
  • Supported formats: PNG, JPG, JPEG, GIF (static)
  • Images exceeding size limit are automatically compressed

list_wecom_bots

List all configured WeCom bots.

Parameters

None

Examples

What WeCom bots are available?
List all configured bots

Response

json
{
  "bots": [
    {
      "id": "default",
      "name": "Default Bot",
      "description": "Default bot (from WECOM_WEBHOOK_URL)",
      "has_webhook": true
    },
    {
      "id": "alert",
      "name": "Alert Bot",
      "description": "For system alerts",
      "has_webhook": true
    }
  ],
  "count": 2
}

Error Handling

All tools return errors in a consistent format:

json
{
  "status": "error",
  "error": "Error message",
  "error_code": "VALIDATION_ERROR"
}

Common Error Codes

CodeDescription
VALIDATION_ERRORInvalid parameters
NETWORK_ERRORNetwork connection failed
API_ERRORWeCom API returned an error
FILE_NOT_FOUNDFile does not exist
FILE_TOO_LARGEFile exceeds size limit

Usage Tips for AI Assistants

  1. Default bot: If the user doesn't specify a bot, use the default bot
  2. Bot selection: Use list_wecom_bots to find available bots when needed
  3. Message type: Use markdown for formatted content, text for simple messages with @mentions
  4. File paths: Accept both absolute and relative paths
  5. Error recovery: If a bot is not found, list available bots and ask the user to choose

Released under the MIT License.