Manus AI 原理深度解析第三篇:Tools

前言

在前两篇文章里面,介绍了Manus的Prompt Manus AI 原理深度解析第一篇:Prompt以及 Modules & Agent Loop Manus AI 原理深度解析第二篇:Modules & Agent Loop,那么这一篇就介绍剩下的Tools了。

Tools 是 Manus 与外部环境交互的具体执行单元,覆盖文件、终端、浏览器、网络等操作,支持多语言和多场景需求。接下来不多废话,直入主题分析。

Message Tools

用于处理用户消息的工具类。

message_notify_user

向用户发送一条无需回复的消息的工作。

用于确认收到消息、提供进度更新、报告任务完成情况或解释方法变更。

  {
   
   
    "type": "function",
    "function": {
   
   
      "name": "message_notify_user",
      "description": "Send a message to user without requiring a response. Use for acknowledging receipt of messages, providing progress updates, reporting task completion, or explaining changes in approach.",
      "parameters": {
   
   
        "type": "object",
        "properties": {
   
   
          "text": {
   
   
            "type": "string",
            "description": "Message text to display to user"
          },
          "attachments": {
   
   
            "anyOf": [
              {
   
   "type": "string"},
              {
   
   "items": {
   
   "type": "string"}, "type": "array"}
            ],
            "description": "(Optional) List of attachments to show to user, can be file paths or URLs"
          }
        },
        "required": ["text"]
      }
    }
  }

message_ask_user

向用户提问并等待回复的工具。

用于请求澄清、确认或收集更多信息。

  {
   
   
    "type": "function",
    "function": {
   
   
      "name": "message_ask_user",
      "description": "Ask user a question and wait for response. Use for requesting clarification, asking for confirmation, or gathering additional information.",
      "parameters": {
   
   
        "type": "object",
        "properties": {
   
   
          "text": {
   
   
            "type": "string",
            "description": "Question text to present to user"
          },
          "attachments": {
   
   
            "anyOf": [
              {
   
   "type": "string"},
              {
   
   "items": {
   
   "type": "string"}, "type": "array"}
            ],
            "description": "(Optional) List of question-related files or reference materials"
          },
          "suggest_user_takeover": {
   
   
            "type": "string",
            "enum": ["none", "browser"],
            "description": "(Optional) Suggested operation for user takeover"
          }
        },
        "required": ["text"]
      }
    }
  }

File Processing Tools

用于处理文件的工具类。

file_read

读取文件内容的工具。

用于检查文件内容、分析日志或读取配置文件。

  {
   
   
    "type": "function",
    "function": {
   
   
      "name": "file_read",
      "description": "Read file content. Use for checking file contents, analyzing logs, or reading configuration files.",
      "parameters": {
   
   
        "type": "object",
        "properties": {
   
   
          "file": {
   
   
            "type": "string",
            "description": "Absolute path of the file to read"
          },
          "start_line": {
   
   
            "type": "integer",
            "description": "(Optional) Starting line to read from, 0-based"
          },
          "end_line": {
   
   
            "type": "integer",
            "description": "(Optional) Ending line number (exclusive)"
          },
          "sudo": {
   
   
            "type": "boolean",
            "description": "(Optional) Whether to use sudo privileges"
          }
        },
        "required": ["file"]
      }
    }
  }

file_write

覆盖或附加内容到文件的工具。

用于创建新文件、附加内容或修改现有文件。

  {
   
   
    "type": "function",
    "function": {
   
   
      "name": "file_write",
      "description": "Overwrite or append content to a file. Use for creating new files, appending content, or modifying existing files.",
      "parameters": {
   
   
        "type": "object",
        "properties": {
   
   
          "file": {
   
   
            "type": "string",
            "description": "Absolute path of the file to write to"
          },
          "content": {
   
   
            "type": "string",
            "description": "Text content to write"
          },
          "append": {
   
   
            "type": "boolean",
            "description": "(Optional) Whether to use append mode"
          },
          "leading_newline": {
   
   
            "type": "boolean",
            "description": "(Optional) Whether to add a leading newline"
          },
          "trailing_newline": {
   
   
            "type": "boolean",
            "description": "(Optional) Whether to add a trailing newline"
          },
          "sudo": {
   
   
            "type": "boolean",
            "description": "(Opt
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

依然易冷

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值