{"entry_id": "cedabd92-12f7-483b-a5d6-57c046abd192", "infos": [{"txt": "一文讲透MCP的原理及实践", "language": "chinese", "position": {"atoms": [{"position_id": 0, "txt": "一文讲透MCP的原理及实践", "x": ""}]}, "tags": [], "label": "O", "web_segment_id": 0, "global_sentence_id": 0, "edu_l1_label": "EDU_O"}, {"txt": "            一文讲透MCP的原理及实践          ", "language": "chinese", "position": {"atoms": [{"position_id": 1840, "txt": "\n            \n一文讲透MCP的原理及实践\n          ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/h1"}]}, "tags": ["h1"], "label": "article_title", "web_segment_id": 37, "global_sentence_id": 1, "edu_l1_label": "BOT"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/AcDsp4eZ9Ly4nB1cF3ILtR2.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 53, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/AcDsp4eZ9Ly4nB1cF3ILtR2.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[1]/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 39, "global_sentence_id": 2, "edu_l1_label": "EDU_O"}, {"txt": "阿里妹导读", "language": "chinese", "position": {"atoms": [{"position_id": 1842, "txt": "阿里妹导读", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[2]/section/section/section[1]/section[2]/section[1]/p/span"}]}, "tags": [], "label": "introduction", "web_segment_id": 40, "global_sentence_id": 3, "edu_l1_label": "EDU_O"}, {"txt": "MCP (Model Context Protocol) 代表了 AI 与外部工具和数据交互的标准建立。", "language": "chinese", "position": {"atoms": [{"position_id": 1844, "txt": "MCP (Model Context Protocol) 代表了 AI 与外部工具和数据交互的标准建立。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[2]/section/section/section[2]/section/p/span/span"}]}, "tags": [], "label": "introduction", "web_segment_id": 41, "global_sentence_id": 4, "edu_l1_label": "IOS"}, {"txt": "通过本文，我们可以了解到MCP的本质、价值、使用与开发。", "language": "chinese", "position": {"atoms": [{"position_id": 1845, "txt": "通过本文，我们可以了解到MCP的本质、价值、使用与开发。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[2]/section/section/section[2]/section/p/span/span"}]}, "tags": [], "label": "introduction", "web_segment_id": 41, "global_sentence_id": 5, "edu_l1_label": "IOS"}, {"txt": "MCP是什么", "language": "chinese", "position": {"atoms": [{"position_id": 1847, "txt": "MCP是什么", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[3]/section/section/p/span"}]}, "tags": [], "label": "content", "web_segment_id": 42, "global_sentence_id": 6, "edu_l1_label": "BOS"}, {"txt": "MCP 是 Anthropic (Claude) 主导发布的一个开放的、通用的、有共识的协议标准。", "language": "chinese", "position": {"atoms": [{"position_id": 1849, "txt": "MCP 是 Anthropic (Claude) 主导发布的一个开放的、通用的、有共识的协议标准。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h2[1]/span[1]/span/span"}]}, "tags": ["h2"], "label": "content", "web_segment_id": 43, "global_sentence_id": 7, "edu_l1_label": "IOS"}, {"txt": "MCP 是一个标准协议，就像给 AI 大模型装了一个 “万能接口”，让 AI 模型能够与不同的数据源和工具进行无缝交互。", "language": "chinese", "position": {"atoms": [{"position_id": 1851, "txt": "MCP 是一个标准协议", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[1]/li/h2/span[1]/span/span"}, {"position_id": 1853, "txt": "，就像给 AI 大模型装了一个 “万能接口”，让 AI 模型能够与不同的数据源和工具进行无缝交互。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[1]/li/h2/span[2]/span/span"}]}, "tags": ["h2", "li"], "label": "content", "web_segment_id": 44, "global_sentence_id": 8, "edu_l1_label": "IOS"}, {"txt": "它就像 USB-C 接口一样，提供了一种标准化的方法，将 AI 模型连接到各种数据源和工具。", "language": "chinese", "position": {"atoms": [{"position_id": 1854, "txt": "它就像 USB-C 接口一样，提供了一种标准化的方法，将 AI 模型连接到各种数据源和工具。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[1]/li/h2/span[2]/span/span"}]}, "tags": ["h2", "li"], "label": "content", "web_segment_id": 44, "global_sentence_id": 9, "edu_l1_label": "IOS"}, {"txt": "MCP 旨在替换碎片化的 Agent 代码集成，从而使 AI 系统更可靠，更有效。", "language": "chinese", "position": {"atoms": [{"position_id": 1856, "txt": "MCP 旨在替换碎片化的 Agent 代码集成", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[2]/li[1]/p/span[1]/span/span"}, {"position_id": 1858, "txt": "，从而使 AI 系统更可靠，更有效。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[2]/li[1]/p/span[2]/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 45, "global_sentence_id": 10, "edu_l1_label": "IOS"}, {"txt": "通过建立通用标准，服务商可以基于协议来推出它们自己服务的 AI 能力，从而支持开发者更快的构建更强大的 AI 应用。", "language": "chinese", "position": {"atoms": [{"position_id": 1859, "txt": "通过建立通用标准，服务商可以基于协议来推出它们自己服务的 AI 能力，从而支持开发者更快的构建更强大的 AI 应用。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[2]/li[1]/p/span[2]/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 45, "global_sentence_id": 11, "edu_l1_label": "IOS"}, {"txt": "开发者也不需要重复造轮子，通过开源项目可以建立强大的 AI Agent 生态。", "language": "chinese", "position": {"atoms": [{"position_id": 1860, "txt": "开发者也不需要重复造轮子，通过开源项目可以建立强大的 AI Agent 生态。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[2]/li[1]/p/span[2]/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 45, "global_sentence_id": 12, "edu_l1_label": "IOS"}, {"txt": "MCP 可以在不同的应用 / 服务之间保持上下文，增强整体自主执行任务的能力。", "language": "chinese", "position": {"atoms": [{"position_id": 1862, "txt": "MCP 可以在不同的应用 / 服务之间保持上下文", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[2]/li[2]/p/span[1]/span/span"}, {"position_id": 1864, "txt": "，增强整体自主执行任务的能力。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[2]/li[2]/p/span[2]/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 46, "global_sentence_id": 13, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 1866, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[1]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 47, "global_sentence_id": 14, "edu_l1_label": "EDU_O"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/1uOFOL4yM8WS1SxISb3K3YwZ.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 130, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/1uOFOL4yM8WS1SxISb3K3YwZ.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[1]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 47, "global_sentence_id": 15, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 1868, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[1]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 47, "global_sentence_id": 16, "edu_l1_label": "EDU_O"}, {"txt": "MCP 架构", "language": "chinese", "position": {"atoms": [{"position_id": 1870, "txt": "MCP 架构", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h2[2]/span/span/span"}]}, "tags": ["h2"], "label": "title1", "web_segment_id": 48, "global_sentence_id": 17, "edu_l1_label": "IOS"}, {"txt": "MCP遵循客户端 - 服务器架构，包含以下几个核心部分：", "language": "chinese", "position": {"atoms": [{"position_id": 1872, "txt": "MCP遵循客户端 - 服务器架构", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[2]/span[1]/span/span"}, {"position_id": 1874, "txt": "，包含以下几个核心部分：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[2]/span[2]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 49, "global_sentence_id": 18, "edu_l1_label": "IOS"}, {"txt": "MCP 主机（MCP Hosts）：", "language": "chinese", "position": {"atoms": [{"position_id": 1876, "txt": "MCP 主机（MCP Hosts）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[3]/li/p/span[1]/span/span"}, {"position_id": 1878, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[3]/li/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 50, "global_sentence_id": 19, "edu_l1_label": "IOS"}, {"txt": "发起请求的 AI 应用程序，比如聊天机器人、AI 驱动的 IDE 等。", "language": "chinese", "position": {"atoms": [{"position_id": 1880, "txt": "发起请求的 AI 应用程序，比如聊天机器人、AI 驱动的 IDE 等。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[3]/li/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 50, "global_sentence_id": 20, "edu_l1_label": "IOS"}, {"txt": "MCP 客户端（MCP Clients）：", "language": "chinese", "position": {"atoms": [{"position_id": 1882, "txt": "MCP 客户端（MCP Clients）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[1]/p/span[1]/span/span"}, {"position_id": 1884, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[1]/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 51, "global_sentence_id": 21, "edu_l1_label": "IOS"}, {"txt": "在主机程序内部，与 MCP 服务器保持 1:", "language": "chinese", "position": {"atoms": [{"position_id": 1886, "txt": "在主机程序内部，与 MCP 服务器保持 1:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[1]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 51, "global_sentence_id": 22, "edu_l1_label": "IOS"}, {"txt": "1 的连接。", "language": "chinese", "position": {"atoms": [{"position_id": 1887, "txt": "1 的连接。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[1]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 51, "global_sentence_id": 23, "edu_l1_label": "IOS"}, {"txt": "MCP 服务器（MCP Servers）：", "language": "chinese", "position": {"atoms": [{"position_id": 1889, "txt": "MCP 服务器（MCP Servers）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[2]/p/span[1]/span/span"}, {"position_id": 1891, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[2]/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 52, "global_sentence_id": 24, "edu_l1_label": "IOS"}, {"txt": "为 MCP 客户端提供上下文、工具和提示信息。", "language": "chinese", "position": {"atoms": [{"position_id": 1893, "txt": "为 MCP 客户端提供上下文、工具和提示信息。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[2]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 52, "global_sentence_id": 25, "edu_l1_label": "IOS"}, {"txt": "本地资源（Local Resources）：", "language": "chinese", "position": {"atoms": [{"position_id": 1895, "txt": "本地资源（Local Resources）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[3]/p/span[1]/span/span"}, {"position_id": 1897, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[3]/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 53, "global_sentence_id": 26, "edu_l1_label": "IOS"}, {"txt": "本地计算机中可供 MCP 服务器安全访问的资源，如文件、数据库。", "language": "chinese", "position": {"atoms": [{"position_id": 1899, "txt": "本地计算机中可供 MCP 服务器安全访问的资源，如文件、数据库。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[3]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 53, "global_sentence_id": 27, "edu_l1_label": "IOS"}, {"txt": "远程资源（Remote Resources）：", "language": "chinese", "position": {"atoms": [{"position_id": 1901, "txt": "远程资源（Remote Resources）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[4]/p/span[1]/span/span"}, {"position_id": 1903, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[4]/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 54, "global_sentence_id": 28, "edu_l1_label": "IOS"}, {"txt": "MCP 服务器可以连接到的远程资源，如通过 API 提供的数据。", "language": "chinese", "position": {"atoms": [{"position_id": 1905, "txt": "MCP 服务器可以连接到的远程资源，如通过 API 提供的数据。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[4]/li[4]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 54, "global_sentence_id": 29, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 1907, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[3]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 55, "global_sentence_id": 30, "edu_l1_label": "EDU_O"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/2h9JMN2XR1mv3IJmgh4dFRYV.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 204, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/2h9JMN2XR1mv3IJmgh4dFRYV.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[3]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 55, "global_sentence_id": 31, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 1909, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[3]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 55, "global_sentence_id": 32, "edu_l1_label": "EDU_O"}, {"txt": "为什么需要 MCP 呢？", "language": "chinese", "position": {"atoms": [{"position_id": 1911, "txt": "为什么需要 MCP 呢？", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h2[3]/span/span/span"}]}, "tags": ["h2"], "label": "title1", "web_segment_id": 56, "global_sentence_id": 33, "edu_l1_label": "IOS"}, {"txt": "举个例子，例如我们目前还不能同时通过某个 AI 应用来做到联网搜索、发送邮件、发布自己的博客等等，这些功能单个实现都不是很难，但是如果要全部集成到一个系统里面，就会变得遥不可及。", "language": "chinese", "position": {"atoms": [{"position_id": 1913, "txt": "举个例子，例如我们目前还不能同时通过某个 AI 应用来做到联网搜索、发送邮件、发布自己的博客等等，这些功能单个实现都不是很难，但是如果要全部集成到一个系统里面，就会变得遥不可及。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[4]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 57, "global_sentence_id": 34, "edu_l1_label": "IOS"}, {"txt": "可以想象一下日常开发中，有一个IDE ，我们可以通过 IDE 的 AI 来完成下面这些工作。", "language": "chinese", "position": {"atoms": [{"position_id": 1914, "txt": "可以想象一下日常开发中，有一个IDE ，我们可以通过 IDE 的 AI 来完成下面这些工作。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[4]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 57, "global_sentence_id": 35, "edu_l1_label": "IOS"}, {"txt": "询问 AI 来查询本地数据库已有的数据来辅助开发", "language": "chinese", "position": {"atoms": [{"position_id": 1916, "txt": "询问 AI 来查询本地数据库已有的数据来辅助开发", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[5]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 58, "global_sentence_id": 36, "edu_l1_label": "IOS"}, {"txt": "询问 AI 搜索 Github Issue 来判断某问题是不是已知的 bug", "language": "chinese", "position": {"atoms": [{"position_id": 1918, "txt": "询问 AI 搜索 Github Issue 来判断某问题是不是已知的 bug", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[5]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 59, "global_sentence_id": 37, "edu_l1_label": "IOS"}, {"txt": "通过 AI 将某个 PR 的意见发送给同事的即时通讯软件 (例如 Slack) 来 Code Review", "language": "chinese", "position": {"atoms": [{"position_id": 1920, "txt": "通过 AI 将某个 PR 的意见发送给同事的即时通讯软件 (例如 Slack) 来 Code Review", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[5]/li[3]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 60, "global_sentence_id": 38, "edu_l1_label": "IOS"}, {"txt": "通过 AI 查询甚至修改当前 AWS、Azure 的配置来完成部署", "language": "chinese", "position": {"atoms": [{"position_id": 1922, "txt": "通过 AI 查询甚至修改当前 AWS、Azure 的配置来完成部署", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[5]/li[4]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 61, "global_sentence_id": 39, "edu_l1_label": "IOS"}, {"txt": "那有了 MCP 呢？", "language": "chinese", "position": {"atoms": [{"position_id": 1924, "txt": "那有了 MCP 呢？", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[5]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 62, "global_sentence_id": 40, "edu_l1_label": "IOS"}, {"txt": "其他服务都遵循 MCP 标准的话，就像万能接口一样，让我们开发更高效了。", "language": "chinese", "position": {"atoms": [{"position_id": 1925, "txt": "其他服务都遵循 MCP 标准的话，就像万能接口一样，让我们开发更高效了。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[5]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 62, "global_sentence_id": 41, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 1927, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[6]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 63, "global_sentence_id": 42, "edu_l1_label": "EDU_O"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/4DwN6H3IR3Ao1jbVIx1y3c7n.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 250, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/4DwN6H3IR3Ao1jbVIx1y3c7n.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[6]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 63, "global_sentence_id": 43, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 1929, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[6]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 63, "global_sentence_id": 44, "edu_l1_label": "EDU_O"}, {"txt": "假设你正在使用一个 AI 编程助手来帮助你写代码。", "language": "chinese", "position": {"atoms": [{"position_id": 1931, "txt": "假设你正在使用一个 AI 编程助手来帮助你写代码。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[7]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 64, "global_sentence_id": 45, "edu_l1_label": "IOS"}, {"txt": "这个 AI 助手就是一个 MCP 主机。", "language": "chinese", "position": {"atoms": [{"position_id": 1932, "txt": "这个 AI 助手就是一个 MCP 主机。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[7]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 64, "global_sentence_id": 46, "edu_l1_label": "IOS"}, {"txt": "它需要访问一些外部资源，比如代码库、文档或者调试工具。", "language": "chinese", "position": {"atoms": [{"position_id": 1933, "txt": "它需要访问一些外部资源，比如代码库、文档或者调试工具。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[7]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 64, "global_sentence_id": 47, "edu_l1_label": "IOS"}, {"txt": "MCP 服务器就像是一个中介，它连接了这些资源和 AI 助手。", "language": "chinese", "position": {"atoms": [{"position_id": 1934, "txt": "MCP 服务器就像是一个中介，它连接了这些资源和 AI 助手。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[7]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 64, "global_sentence_id": 48, "edu_l1_label": "IOS"}, {"txt": "当你需要查找某个函数的用法时，AI 助手通过 MCP 客户端向 MCP 服务器发送请求。", "language": "chinese", "position": {"atoms": [{"position_id": 1936, "txt": "当你需要查找某个函数的用法时，AI 助手通过 MCP 客户端向 MCP 服务器发送请求。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[6]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 65, "global_sentence_id": 49, "edu_l1_label": "IOS"}, {"txt": "MCP 服务器接收到请求后，去代码库或文档中查找相关信息。", "language": "chinese", "position": {"atoms": [{"position_id": 1938, "txt": "MCP 服务器接收到请求后，去代码库或文档中查找相关信息。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[6]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 66, "global_sentence_id": 50, "edu_l1_label": "IOS"}, {"txt": "找到信息后，MCP 服务器将结果返回给 AI 助手。", "language": "chinese", "position": {"atoms": [{"position_id": 1940, "txt": "找到信息后，MCP 服务器将结果返回给 AI 助手。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[6]/li[3]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 67, "global_sentence_id": 51, "edu_l1_label": "IOS"}, {"txt": "AI 助手根据返回的信息，生成一段代码或解释，展示给你。", "language": "chinese", "position": {"atoms": [{"position_id": 1942, "txt": "AI 助手根据返回的信息，生成一段代码或解释，展示给你。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[6]/li[4]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 68, "global_sentence_id": 52, "edu_l1_label": "IOS"}, {"txt": "使用 MCP 后，你直接对 AI 说：", "language": "chinese", "position": {"atoms": [{"position_id": 1944, "txt": "使用 MCP 后，你直接对 AI 说：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[8]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 69, "global_sentence_id": 53, "edu_l1_label": "IOS"}, {"txt": "“帮我查一下最近数学考试的平均分，把不及格的同学名单整理到值日表里，并在微信群提醒他们补考。”", "language": "chinese", "position": {"atoms": [{"position_id": 1945, "txt": "“帮我查一下最近数学考试的平均分，把不及格的同学名单整理到值日表里，并在微信群提醒他们补考。”", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[8]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 69, "global_sentence_id": 54, "edu_l1_label": "IOS"}, {"txt": "AI 会自动完成：", "language": "chinese", "position": {"atoms": [{"position_id": 1946, "txt": "AI 会自动完成：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[8]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 69, "global_sentence_id": 55, "edu_l1_label": "IOS"}, {"txt": "用 “万能插头” MCP 连接你的电脑，读取 Excel 成绩。", "language": "chinese", "position": {"atoms": [{"position_id": 1947, "txt": "用 “万能插头” MCP 连接你的电脑，读取 Excel 成绩。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[8]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 69, "global_sentence_id": 56, "edu_l1_label": "IOS"}, {"txt": "用 MCP 连接微信，找到相关聊天记录。", "language": "chinese", "position": {"atoms": [{"position_id": 1948, "txt": "用 MCP 连接微信，找到相关聊天记录。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[8]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 69, "global_sentence_id": 57, "edu_l1_label": "IOS"}, {"txt": "用 MCP 修改在线文档，更新值日表。", "language": "chinese", "position": {"atoms": [{"position_id": 1949, "txt": "用 MCP 修改在线文档，更新值日表。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[8]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 69, "global_sentence_id": 58, "edu_l1_label": "IOS"}, {"txt": "整个过程不需要你手动操作，数据也不会离开你的设备，安全又高效。", "language": "chinese", "position": {"atoms": [{"position_id": 1950, "txt": "整个过程不需要你手动操作，数据也不会离开你的设备，安全又高效。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[8]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 69, "global_sentence_id": 59, "edu_l1_label": "IOS"}, {"txt": "所以，MCP 厉害的地方在于，不用重复造轮子。", "language": "chinese", "position": {"atoms": [{"position_id": 1952, "txt": "所以，MCP 厉害的地方在于，不用重复造轮子。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[9]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 70, "global_sentence_id": 60, "edu_l1_label": "IOS"}, {"txt": "过去每个软件（比如微信、Excel）都要单独给 AI 做接口，现在 MCP 统一了标准，就像所有电器都用 USB-C 充电口，AI 一个接口就能连接所有工具。", "language": "chinese", "position": {"atoms": [{"position_id": 1953, "txt": "过去每个软件（比如微信、Excel）都要单独给 AI 做接口，现在 MCP 统一了标准，就像所有电器都用 USB-C 充电口，AI 一个接口就能连接所有工具。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[9]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 70, "global_sentence_id": 61, "edu_l1_label": "IOS"}, {"txt": "而且，数据不用上传到云端，AI 直接在本地处理。", "language": "chinese", "position": {"atoms": [{"position_id": 1954, "txt": "而且，数据不用上传到云端，AI 直接在本地处理。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[9]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 70, "global_sentence_id": 62, "edu_l1_label": "IOS"}, {"txt": "比如你的成绩单只存在自己电脑里，AI 通过 MCP 读取分析，但数据不会外泄。", "language": "chinese", "position": {"atoms": [{"position_id": 1955, "txt": "比如你的成绩单只存在自己电脑里，AI 通过 MCP 读取分析，但数据不会外泄。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[9]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 70, "global_sentence_id": 63, "edu_l1_label": "IOS"}, {"txt": "MCP 会让 AI 更 “懂” 上下文，比如你让 AI “总结上周班会的重点”，它能自动调取会议录音、聊天记录、笔记文档，综合这些信息给你答案，而不是凭空编造。", "language": "chinese", "position": {"atoms": [{"position_id": 1957, "txt": "MCP 会让 AI 更 “懂” 上下文，比如你让 AI “总结上周班会的重点”，它能自动调取会议录音、聊天记录、笔记文档，综合这些信息给你答案，而不是凭空编造。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[10]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 71, "global_sentence_id": 64, "edu_l1_label": "IOS"}, {"txt": "所以，MCP 为 AI 应用提供了一个强大的工具，使其能够更灵活、更安全地与外部世界交互。", "language": "chinese", "position": {"atoms": [{"position_id": 1958, "txt": "所以，MCP 为 AI 应用提供了一个强大的工具，使其能够更灵活、更安全地与外部世界交互。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[10]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 71, "global_sentence_id": 65, "edu_l1_label": "IOS"}, {"txt": "MCP原理", "language": "chinese", "position": {"atoms": [{"position_id": 1960, "txt": "MCP原理", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[4]/section/section/p/span"}]}, "tags": [], "label": "content", "web_segment_id": 72, "global_sentence_id": 66, "edu_l1_label": "BOS"}, {"txt": "VS Function Call", "language": "chinese", "position": {"atoms": [{"position_id": 1962, "txt": "VS", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h2[4]/span[1]/span/span"}, {"position_id": 1964, "txt": " Function Call", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h2[4]/span[2]/span/span"}]}, "tags": ["h2"], "label": "title1", "web_segment_id": 73, "global_sentence_id": 67, "edu_l1_label": "IOS"}, {"txt": "MCP的诞生标志着prompt engineering进入了一个新的发展阶段，它通过提供更结构化的上下文信息，显著提升了模型的能力。", "language": "chinese", "position": {"atoms": [{"position_id": 1966, "txt": "MCP的诞生标志着prompt engineering进入了一个新的发展阶段，它通过提供更结构化的上下文信息，显著提升了模型的能力。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[11]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 74, "global_sentence_id": 68, "edu_l1_label": "IOS"}, {"txt": "在设计prompt时，我们的目标是能够将更加具体的信息（如本地文件、数据库内容或网络实时数据等）集成进来，从而使模型能够更好地理解和解决实际问题。", "language": "chinese", "position": {"atoms": [{"position_id": 1967, "txt": "在设计prompt时，我们的目标是能够将更加具体的信息（如本地文件、数据库内容或网络实时数据等）集成进来，从而使模型能够更好地理解和解决实际问题。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[11]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 74, "global_sentence_id": 69, "edu_l1_label": "IOS"}, {"txt": "回顾没有 MCP 的时代，为了解决复杂问题，我们不得不手动从数据库中筛选信息或使用工具来检索相关信息，并将其逐一添加到 prompt 中。", "language": "chinese", "position": {"atoms": [{"position_id": 1969, "txt": "回顾没有 MCP 的时代，为了解决复杂问题，我们不得不手动从数据库中筛选信息或使用工具来检索相关信息，并将其逐一添加到 prompt 中。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[12]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 75, "global_sentence_id": 70, "edu_l1_label": "IOS"}, {"txt": "处理简单问题时如需要大模型做归纳总结这种方法很奏效，但随着问题复杂度的增加，这种方法变得越来越难以应对。", "language": "chinese", "position": {"atoms": [{"position_id": 1970, "txt": "处理简单问题时如需要大模型做归纳总结这种方法很奏效，但随着问题复杂度的增加，这种方法变得越来越难以应对。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[12]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 75, "global_sentence_id": 71, "edu_l1_label": "IOS"}, {"txt": "为了克服这些挑战，许多大型语言模型（LLM）平台（例如 OpenAI 和 Google）引入了 function call 功能。", "language": "chinese", "position": {"atoms": [{"position_id": 1972, "txt": "为了克服这些挑战，许多大型语言模型（LLM）平台（例如 OpenAI 和 Google）引入了 function call 功能。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[13]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 76, "global_sentence_id": 72, "edu_l1_label": "IOS"}, {"txt": "这一机制允许模型根据需要调用预定义函数以获取数据或执行特定操作，大大提高了自动化程度。", "language": "chinese", "position": {"atoms": [{"position_id": 1973, "txt": "这一机制允许模型根据需要调用预定义函数以获取数据或执行特定操作，大大提高了自动化程度。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[13]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 76, "global_sentence_id": 73, "edu_l1_label": "IOS"}, {"txt": "然而，function call 也有其局限性，包括对平台的高度依赖以及不同 LLM 平台间 API 实现的差异，这使得开发者在切换模型时必须重写代码，增加了开发成本。", "language": "chinese", "position": {"atoms": [{"position_id": 1974, "txt": "然而，function call 也有其局限性，包括对平台的高度依赖以及不同 LLM 平台间 API 实现的差异，这使得开发者在切换模型时必须重写代码，增加了开发成本。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[13]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 76, "global_sentence_id": 74, "edu_l1_label": "IOS"}, {"txt": "此外，还存在安全性和交互性等方面的挑战。", "language": "chinese", "position": {"atoms": [{"position_id": 1975, "txt": "此外，还存在安全性和交互性等方面的挑战。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[13]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 76, "global_sentence_id": 75, "edu_l1_label": "IOS"}, {"txt": "实际上，数据和工具一直都在那里，关键在于如何更智能、更统一地将它们与模型连接起来。", "language": "chinese", "position": {"atoms": [{"position_id": 1977, "txt": "实际上，数据和工具一直都在那里，关键在于如何更智能、更统一地将它们与模型连接起来。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[14]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 77, "global_sentence_id": 76, "edu_l1_label": "IOS"}, {"txt": "Anthropic 基于这样的需求设计了 MCP，作为 AI 模型的“万能适配器”，让 LLM 能够轻松访问数据或调用工具。", "language": "chinese", "position": {"atoms": [{"position_id": 1978, "txt": "Anthropic 基于这样的需求设计了 MCP，作为 AI 模型的“万能适配器”，让 LLM 能够轻松访问数据或调用工具。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[14]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 77, "global_sentence_id": 77, "edu_l1_label": "IOS"}, {"txt": "具体而言，MCP 的优势体现在以下几个方面：", "language": "chinese", "position": {"atoms": [{"position_id": 1979, "txt": "具体而言，MCP 的优势体现在以下几个方面：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[14]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 77, "global_sentence_id": 78, "edu_l1_label": "IOS"}, {"txt": "生态系统：", "language": "chinese", "position": {"atoms": [{"position_id": 1981, "txt": "生态系统", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[1]/p/span[1]/span/span"}, {"position_id": 1983, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[1]/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 78, "global_sentence_id": 79, "edu_l1_label": "IOS"}, {"txt": "MCP 提供了丰富的插件库，使您的 AI 应用可以直接利用。", "language": "chinese", "position": {"atoms": [{"position_id": 1985, "txt": "MCP 提供了丰富的插件库，使您的 AI 应用可以直接利用。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[1]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 78, "global_sentence_id": 80, "edu_l1_label": "IOS"}, {"txt": "所有的服务提供商都可以按MCP协议进行接入，开者可以直接使用。", "language": "chinese", "position": {"atoms": [{"position_id": 1986, "txt": "所有的服务提供商都可以按MCP协议进行接入，开者可以直接使用。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[1]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 78, "global_sentence_id": 81, "edu_l1_label": "IOS"}, {"txt": "可以预见，这个生态会越来越庞大，生态越庞大，AI的能力越强。", "language": "chinese", "position": {"atoms": [{"position_id": 1987, "txt": "可以预见，这个生态会越来越庞大，生态越庞大，AI的能力越强。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[1]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 78, "global_sentence_id": 82, "edu_l1_label": "IOS"}, {"txt": "兼容性：", "language": "chinese", "position": {"atoms": [{"position_id": 1989, "txt": "兼容性", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[2]/p/span[1]/span/span"}, {"position_id": 1991, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[2]/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 79, "global_sentence_id": 83, "edu_l1_label": "IOS"}, {"txt": "大家只要遵循一套协议，都可以实现“万物互联”。", "language": "chinese", "position": {"atoms": [{"position_id": 1993, "txt": "大家只要遵循一套协议，都可以实现“万物互联”。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[2]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 79, "global_sentence_id": 84, "edu_l1_label": "IOS"}, {"txt": "不限于特定的 AI 模型，任何支持 MCP 的模型都能灵活切换使用。", "language": "chinese", "position": {"atoms": [{"position_id": 1994, "txt": "不限于特定的 AI 模型，任何支持 MCP 的模型都能灵活切换使用。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[7]/li[2]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 79, "global_sentence_id": 85, "edu_l1_label": "IOS"}, {"txt": "模型如何智能选择Agent/工具", "language": "chinese", "position": {"atoms": [{"position_id": 1996, "txt": "模型如何智能选择Agent/工具", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h2[5]/span/span/span"}]}, "tags": ["h2"], "label": "title1", "web_segment_id": 80, "global_sentence_id": 86, "edu_l1_label": "IOS"}, {"txt": "MCP是核心是让我们能方便地调用多个工具，那随之而来的问题是LLM（模型）是在什么时候确定使用哪些工具的呢？", "language": "chinese", "position": {"atoms": [{"position_id": 1998, "txt": "MCP是核心是让我们能方便地调用多个工具，那随之而来的问题是LLM（模型）是在什么时候确定使用哪些工具的呢？", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[15]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 81, "global_sentence_id": 87, "edu_l1_label": "IOS"}, {"txt": " Anthropic 为我们提供了详细的解释，当用户提出一个问题时：", "language": "chinese", "position": {"atoms": [{"position_id": 1999, "txt": " Anthropic 为我们提供了详细的解释，当用户提出一个问题时：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[15]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 81, "global_sentence_id": 88, "edu_l1_label": "IOS"}, {"txt": "客户端（Claude Desktop / Cursor）将问题发送给 LLM。", "language": "chinese", "position": {"atoms": [{"position_id": 2001, "txt": "客户端（Claude Desktop / Cursor）将问题发送给 LLM。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[8]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 82, "global_sentence_id": 89, "edu_l1_label": "IOS"}, {"txt": "LLM 分析可用的工具，并决定使用哪一个（或多个）。", "language": "chinese", "position": {"atoms": [{"position_id": 2003, "txt": "LLM 分析可用的工具，并决定使用哪一个（或多个）。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[8]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 83, "global_sentence_id": 90, "edu_l1_label": "IOS"}, {"txt": "客户端通过 MCP Server 执行所选的工具。", "language": "chinese", "position": {"atoms": [{"position_id": 2005, "txt": "客户端通过 MCP Server 执行所选的工具。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[8]/li[3]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 84, "global_sentence_id": 91, "edu_l1_label": "IOS"}, {"txt": "工具的执行结果被送回给 LLM。", "language": "chinese", "position": {"atoms": [{"position_id": 2007, "txt": "工具的执行结果被送回给 LLM。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[8]/li[4]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 85, "global_sentence_id": 92, "edu_l1_label": "IOS"}, {"txt": "LLM 结合执行结果，归纳总结后生成自然语言展示给用户！", "language": "chinese", "position": {"atoms": [{"position_id": 2009, "txt": "LLM 结合执行结果，归纳总结后生成自然语言展示给用户！", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[8]/li[5]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 86, "global_sentence_id": 93, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 2011, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[16]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 87, "global_sentence_id": 94, "edu_l1_label": "EDU_O"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/HuFlD1BIDSu2JiHZt3ODXIS.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 381, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/HuFlD1BIDSu2JiHZt3ODXIS.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[16]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 87, "global_sentence_id": 95, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 2013, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[16]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 87, "global_sentence_id": 96, "edu_l1_label": "EDU_O"}, {"txt": "先理解第一步模型如何确定该使用哪些工具？", "language": "chinese", "position": {"atoms": [{"position_id": 2015, "txt": "先理解第一步模型如何确定该使用哪些工具？", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[17]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 88, "global_sentence_id": 97, "edu_l1_label": "IOS"}, {"txt": "我们可以参考MCP官方提供的client example为讲解示例，并对相关代码进行了简化处理（移除了不影响逻辑理解的异常控制代码部分）。", "language": "chinese", "position": {"atoms": [{"position_id": 2016, "txt": "我们可以参考MCP官方提供的client example为讲解示例，并对相关代码进行了简化处理（移除了不影响逻辑理解的异常控制代码部分）。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[17]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 88, "global_sentence_id": 98, "edu_l1_label": "IOS"}, {"txt": "通过分析这段代码，可以看出模型是依靠prompt来识别当前可用的工具有哪些。", "language": "chinese", "position": {"atoms": [{"position_id": 2017, "txt": "通过分析这段代码，可以看出", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[17]/span[1]/span/span"}, {"position_id": 2019, "txt": "模型是依靠prompt来识别当前可用的工具有哪些", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[17]/span[2]/span/span"}, {"position_id": 2021, "txt": "。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[17]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 88, "global_sentence_id": 99, "edu_l1_label": "IOS"}, {"txt": "具体做法是，我们将各个工具的使用描述以文本形式传递给模型，从而使模型能够了解有哪些工具可供选择，并基于实时情况做出最佳选择。", "language": "chinese", "position": {"atoms": [{"position_id": 2022, "txt": "具体做法是，我们将各个工具的使用描述以文本形式传递给模型，从而使模型能够了解有哪些工具可供选择，并基于实时情况做出最佳选择。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[17]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 88, "global_sentence_id": 100, "edu_l1_label": "IOS"}, {"txt": "参考代码中的注释部分：", "language": "chinese", "position": {"atoms": [{"position_id": 2023, "txt": "参考代码中的注释部分：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[17]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 88, "global_sentence_id": 101, "edu_l1_label": "IOS"}, {"txt": "... # 省略了无关的代码asyncdefstart(self):", "language": "chinese", "position": {"atoms": [{"position_id": 2025, "txt": "... ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[1]/span"}, {"position_id": 2027, "txt": "# 省略了无关的代码", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[1]/span/span"}, {"position_id": 2029, "txt": "async", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[2]/span/span[1]"}, {"position_id": 2031, "txt": "def", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[2]/span/span[2]"}, {"position_id": 2033, "txt": "start", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[2]/span/span[3]"}, {"position_id": 2035, "txt": "(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[2]/span/span[3]"}, {"position_id": 2037, "txt": "self", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[2]/span/span[4]"}, {"position_id": 2039, "txt": "):", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[2]/span/span[4]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 102, "edu_l1_label": "EDU_O"}, {"txt": "# 初始化所有的 mcp serverfor server in self.servers:", "language": "chinese", "position": {"atoms": [{"position_id": 2041, "txt": "# 初始化所有的 mcp server", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[3]/span/span"}, {"position_id": 2043, "txt": "for", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[4]/span/span[1]"}, {"position_id": 2045, "txt": " server ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[4]/span/span[1]"}, {"position_id": 2047, "txt": "in", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[4]/span/span[2]"}, {"position_id": 2049, "txt": " self.servers:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[4]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 103, "edu_l1_label": "EDU_O"}, {"txt": "await server.initialize()# 获取所有的 tools 命名为 all_tools     all_tools = []for server in self.servers:", "language": "chinese", "position": {"atoms": [{"position_id": 2051, "txt": "await", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[5]/span/span"}, {"position_id": 2053, "txt": " server.initialize()", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[5]/span/span"}, {"position_id": 2055, "txt": "# 获取所有的 tools 命名为 all_tools", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[7]/span/span"}, {"position_id": 2057, "txt": "     all_tools = []", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[8]/span"}, {"position_id": 2059, "txt": "for", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[9]/span/span[1]"}, {"position_id": 2061, "txt": " server ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[9]/span/span[1]"}, {"position_id": 2063, "txt": "in", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[9]/span/span[2]"}, {"position_id": 2065, "txt": " self.servers:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[9]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 104, "edu_l1_label": "EDU_O"}, {"txt": "         tools = await server.list_tools()         all_tools.extend(tools)# 将所有的 tools 的功能描述格式化成字符串供 LLM 使用# tool.format_for_llm() 我放到了这段代码最后，方便阅读。", "language": "chinese", "position": {"atoms": [{"position_id": 2067, "txt": "         tools = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[10]/span"}, {"position_id": 2069, "txt": "await", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[10]/span/span"}, {"position_id": 2071, "txt": " server.list_tools()", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[10]/span/span"}, {"position_id": 2073, "txt": "         all_tools.extend(tools)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[11]/span"}, {"position_id": 2075, "txt": "# 将所有的 tools 的功能描述格式化成字符串供 LLM 使用", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[13]/span/span"}, {"position_id": 2077, "txt": "# tool.format_for_llm() 我放到了这段代码最后，方便阅读。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[14]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 105, "edu_l1_label": "EDU_O"}, {"txt": "     tools_description = \"\\n\".join(         [tool.format_for_llm() for tool in all_tools]     )# 询问 LLM（Claude） 应该使用哪些工具。", "language": "chinese", "position": {"atoms": [{"position_id": 2079, "txt": "     tools_description = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[15]/span"}, {"position_id": 2081, "txt": "\"\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[15]/span/span"}, {"position_id": 2083, "txt": ".join(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[15]/span/span"}, {"position_id": 2085, "txt": "         [tool.format_for_llm() ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[16]/span"}, {"position_id": 2087, "txt": "for", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[16]/span/span[1]"}, {"position_id": 2089, "txt": " tool ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[16]/span/span[1]"}, {"position_id": 2091, "txt": "in", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[16]/span/span[2]"}, {"position_id": 2093, "txt": " all_tools]", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[16]/span/span[2]"}, {"position_id": 2095, "txt": "     )", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[17]/span"}, {"position_id": 2097, "txt": "# 询问 LLM（Claude） 应该使用哪些工具。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[19]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 106, "edu_l1_label": "EDU_O"}, {"txt": "     system_message = (\"You are a helpful assistant with access to these tools:", "language": "chinese", "position": {"atoms": [{"position_id": 2099, "txt": "     system_message = (", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[20]/span"}, {"position_id": 2101, "txt": "\"You are a helpful assistant with access to these tools:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[21]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 107, "edu_l1_label": "EDU_O"}, {"txt": "\\n\\n\"f\"{tools_description}\\n\"\"Choose the appropriate tool based on the user's question. \"\"", "language": "chinese", "position": {"atoms": [{"position_id": 2102, "txt": "\\n\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[21]/span/span"}, {"position_id": 2104, "txt": "f\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[22]/span/span[1]"}, {"position_id": 2106, "txt": "{tools_description}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[22]/span/span[2]/span"}, {"position_id": 2108, "txt": "\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[22]/span/span[3]"}, {"position_id": 2110, "txt": "\"Choose the appropriate tool based on the user's question. \"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[23]/span/span"}, {"position_id": 2112, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[24]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 108, "edu_l1_label": "EDU_O"}, {"txt": "If no tool is needed, reply directly.\\n\\n\"\"IMPORTANT:", "language": "chinese", "position": {"atoms": [{"position_id": 2113, "txt": "If no tool is needed, reply directly.\\n\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[24]/span/span"}, {"position_id": 2115, "txt": "\"IMPORTANT:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[25]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 109, "edu_l1_label": "EDU_O"}, {"txt": " When you need to use a tool, you must ONLY respond with \"\"the exact JSON object format below, nothing else:", "language": "chinese", "position": {"atoms": [{"position_id": 2116, "txt": " When you need to use a tool, you must ONLY respond with \"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[25]/span/span"}, {"position_id": 2118, "txt": "\"the exact JSON object format below, nothing else:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[26]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 110, "edu_l1_label": "EDU_O"}, {"txt": "\\n\"\"{\\n\"'    \"tool\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2119, "txt": "\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[26]/span/span"}, {"position_id": 2121, "txt": "\"{\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[27]/span/span"}, {"position_id": 2123, "txt": "'    \"tool\": \"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[28]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 111, "edu_l1_label": "EDU_O"}, {"txt": "tool-name\",\\n''    \"arguments\":", "language": "chinese", "position": {"atoms": [{"position_id": 2124, "txt": "tool-name\",\\n'", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[28]/span/span"}, {"position_id": 2126, "txt": "'    \"arguments\":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[29]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 112, "edu_l1_label": "EDU_O"}, {"txt": " {\\n''        \"argument-name\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2127, "txt": " {\\n'", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[29]/span/span"}, {"position_id": 2129, "txt": "'        \"argument-name\": \"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[30]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 113, "edu_l1_label": "EDU_O"}, {"txt": "value\"\\n'\"    }\\n\"\"}\\n\\n\"\"After receiving a tool's response:", "language": "chinese", "position": {"atoms": [{"position_id": 2130, "txt": "value\"\\n'", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[30]/span/span"}, {"position_id": 2132, "txt": "\"    }\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[31]/span/span"}, {"position_id": 2134, "txt": "\"}\\n\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[32]/span/span"}, {"position_id": 2136, "txt": "\"After receiving a tool's response:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[33]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 114, "edu_l1_label": "EDU_O"}, {"txt": "\\n\"\"1. Transform the raw data into a natural, conversational response\\n\"\"2. Keep responses concise but informative\\n\"\"3. Focus on the most relevant information\\n\"\"4. Use appropriate context from the user's question\\n\"\"5. Avoid simply repeating the raw data\\n\\n\"\"Please use only the tools that are explicitly defined above.\"     )     messages = [{\"role\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2137, "txt": "\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[33]/span/span"}, {"position_id": 2139, "txt": "\"1. Transform the raw data into a natural, conversational response\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[34]/span/span"}, {"position_id": 2141, "txt": "\"2. Keep responses concise but informative\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[35]/span/span"}, {"position_id": 2143, "txt": "\"3. Focus on the most relevant information\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[36]/span/span"}, {"position_id": 2145, "txt": "\"4. Use appropriate context from the user's question\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[37]/span/span"}, {"position_id": 2147, "txt": "\"5. Avoid simply repeating the raw data\\n\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[38]/span/span"}, {"position_id": 2149, "txt": "\"Please use only the tools that are explicitly defined above.\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[39]/span/span"}, {"position_id": 2151, "txt": "     )", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[40]/span"}, {"position_id": 2153, "txt": "     messages = [{", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span"}, {"position_id": 2155, "txt": "\"role\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span/span[1]"}, {"position_id": 2157, "txt": ": ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span/span[1]"}, {"position_id": 2159, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 115, "edu_l1_label": "EDU_O"}, {"txt": "system\", \"content\":", "language": "chinese", "position": {"atoms": [{"position_id": 2160, "txt": "system\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span/span[2]"}, {"position_id": 2162, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span/span[2]"}, {"position_id": 2164, "txt": "\"content\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span/span[3]"}, {"position_id": 2166, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 116, "edu_l1_label": "EDU_O"}, {"txt": " system_message}]whileTrue:", "language": "chinese", "position": {"atoms": [{"position_id": 2167, "txt": " system_message}]", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[41]/span/span[3]"}, {"position_id": 2169, "txt": "while", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[43]/span/span[1]"}, {"position_id": 2171, "txt": "True", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[43]/span/span[2]"}, {"position_id": 2173, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[43]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 117, "edu_l1_label": "EDU_O"}, {"txt": "# Final... 假设这里已经处理了用户消息输入.", "language": "chinese", "position": {"atoms": [{"position_id": 2175, "txt": "# Final... 假设这里已经处理了用户消息输入.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[44]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 118, "edu_l1_label": "EDU_O"}, {"txt": "         messages.append({\"role\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2177, "txt": "         messages.append({", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span"}, {"position_id": 2179, "txt": "\"role\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span/span[1]"}, {"position_id": 2181, "txt": ": ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span/span[1]"}, {"position_id": 2183, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 119, "edu_l1_label": "EDU_O"}, {"txt": "user\", \"content\":", "language": "chinese", "position": {"atoms": [{"position_id": 2184, "txt": "user\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span/span[2]"}, {"position_id": 2186, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span/span[2]"}, {"position_id": 2188, "txt": "\"content\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span/span[3]"}, {"position_id": 2190, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 120, "edu_l1_label": "EDU_O"}, {"txt": " user_input})# 将 system_message 和用户消息输入一起发送给 LLM         llm_response = self.llm_client.get_response(messages)     ... # 后面和确定使用哪些工具无关classTool:\"\"\"", "language": "chinese", "position": {"atoms": [{"position_id": 2191, "txt": " user_input})", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[45]/span/span[3]"}, {"position_id": 2193, "txt": "# 将 system_message 和用户消息输入一起发送给 LLM", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[47]/span/span"}, {"position_id": 2195, "txt": "         llm_response = self.llm_client.get_response(messages)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[48]/span"}, {"position_id": 2197, "txt": "     ... ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[50]/span"}, {"position_id": 2199, "txt": "# 后面和确定使用哪些工具无关", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[50]/span/span"}, {"position_id": 2201, "txt": "class", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[53]/span/span[1]"}, {"position_id": 2203, "txt": "Tool", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[53]/span/span[2]"}, {"position_id": 2205, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[53]/span/span[2]"}, {"position_id": 2207, "txt": "\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[54]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 121, "edu_l1_label": "EDU_O"}, {"txt": "Represents a tool with its properties and formatting.\"\"\"def__init__(         self, name:", "language": "chinese", "position": {"atoms": [{"position_id": 2208, "txt": "Represents a tool with its properties and formatting.\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[54]/span/span"}, {"position_id": 2210, "txt": "def", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[56]/span/span[1]"}, {"position_id": 2212, "txt": "__init__", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[56]/span/span[2]"}, {"position_id": 2214, "txt": "(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[56]/span/span[2]"}, {"position_id": 2216, "txt": "         self, name:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 122, "edu_l1_label": "EDU_O"}, {"txt": " str, description:", "language": "chinese", "position": {"atoms": [{"position_id": 2217, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span"}, {"position_id": 2219, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[1]"}, {"position_id": 2221, "txt": ", description:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[1]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 123, "edu_l1_label": "EDU_O"}, {"txt": " str, input_schema:", "language": "chinese", "position": {"atoms": [{"position_id": 2222, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[1]"}, {"position_id": 2224, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[2]"}, {"position_id": 2226, "txt": ", input_schema:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 124, "edu_l1_label": "EDU_O"}, {"txt": " dict[str, Any]     ) -> None:", "language": "chinese", "position": {"atoms": [{"position_id": 2227, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[2]"}, {"position_id": 2229, "txt": "dict", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[3]"}, {"position_id": 2231, "txt": "[", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[3]"}, {"position_id": 2233, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[4]"}, {"position_id": 2235, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[4]"}, {"position_id": 2237, "txt": "Any", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[5]"}, {"position_id": 2239, "txt": "]", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[57]/span/span[5]"}, {"position_id": 2241, "txt": "     ) -> ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[58]/span"}, {"position_id": 2243, "txt": "None", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[58]/span/span"}, {"position_id": 2245, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[58]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 125, "edu_l1_label": "EDU_O"}, {"txt": "         self.name:", "language": "chinese", "position": {"atoms": [{"position_id": 2247, "txt": "         self.name:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[59]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 126, "edu_l1_label": "EDU_O"}, {"txt": " str = name         self.description:", "language": "chinese", "position": {"atoms": [{"position_id": 2248, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[59]/span"}, {"position_id": 2250, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[59]/span/span"}, {"position_id": 2252, "txt": " = name", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[59]/span/span"}, {"position_id": 2254, "txt": "         self.description:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[60]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 127, "edu_l1_label": "EDU_O"}, {"txt": " str = description         self.input_schema:", "language": "chinese", "position": {"atoms": [{"position_id": 2255, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[60]/span"}, {"position_id": 2257, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[60]/span/span"}, {"position_id": 2259, "txt": " = description", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[60]/span/span"}, {"position_id": 2261, "txt": "         self.input_schema:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[61]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 128, "edu_l1_label": "EDU_O"}, {"txt": " dict[str, Any] = input_schema# 把工具的名字 / 工具的用途（description）和工具所需要的参数（args_desc）转化为文本defformat_for_llm(self) -> str:\"\"\"", "language": "chinese", "position": {"atoms": [{"position_id": 2262, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[61]/span"}, {"position_id": 2264, "txt": "dict", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[61]/span/span[1]"}, {"position_id": 2266, "txt": "[", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[61]/span/span[1]"}, {"position_id": 2268, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[61]/span/span[2]"}, {"position_id": 2270, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[61]/span/span[2]"}, {"position_id": 2272, "txt": "Any", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[61]/span/span[3]"}, {"position_id": 2274, "txt": "] = input_schema", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[61]/span/span[3]"}, {"position_id": 2276, "txt": "# 把工具的名字 / 工具的用途（description）和工具所需要的参数（args_desc）转化为文本", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[63]/span/span"}, {"position_id": 2278, "txt": "def", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[64]/span/span[1]"}, {"position_id": 2280, "txt": "format_for_llm", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[64]/span/span[2]"}, {"position_id": 2282, "txt": "(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[64]/span/span[2]"}, {"position_id": 2284, "txt": "self", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[64]/span/span[3]"}, {"position_id": 2286, "txt": ") -> ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[64]/span/span[3]"}, {"position_id": 2288, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[64]/span/span[4]"}, {"position_id": 2290, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[64]/span/span[4]"}, {"position_id": 2292, "txt": "\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[65]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 129, "edu_l1_label": "EDU_O"}, {"txt": "Format tool information for LLM.", "language": "chinese", "position": {"atoms": [{"position_id": 2293, "txt": "Format tool information for LLM.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[65]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 130, "edu_l1_label": "EDU_O"}, {"txt": "         Returns:", "language": "chinese", "position": {"atoms": [{"position_id": 2295, "txt": "         Returns:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[67]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 131, "edu_l1_label": "EDU_O"}, {"txt": "             A formatted string describing the tool.         \"\"\"", "language": "chinese", "position": {"atoms": [{"position_id": 2297, "txt": "             A formatted string describing the tool.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[68]/span"}, {"position_id": 2299, "txt": "         \"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[69]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 132, "edu_l1_label": "EDU_O"}, {"txt": "         args_desc = []if\"properties\"in self.input_schema:", "language": "chinese", "position": {"atoms": [{"position_id": 2301, "txt": "         args_desc = []", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[70]/span"}, {"position_id": 2303, "txt": "if", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[71]/span/span[1]"}, {"position_id": 2305, "txt": "\"properties\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[71]/span/span[2]"}, {"position_id": 2307, "txt": "in", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[71]/span/span[3]"}, {"position_id": 2309, "txt": " self.input_schema:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[71]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 133, "edu_l1_label": "EDU_O"}, {"txt": "for param_name, param_info in self.input_schema[\"properties\"].items():", "language": "chinese", "position": {"atoms": [{"position_id": 2311, "txt": "for", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[72]/span/span[1]"}, {"position_id": 2313, "txt": " param_name, param_info ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[72]/span/span[1]"}, {"position_id": 2315, "txt": "in", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[72]/span/span[2]"}, {"position_id": 2317, "txt": " self.input_schema[", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[72]/span/span[2]"}, {"position_id": 2319, "txt": "\"properties\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[72]/span/span[3]"}, {"position_id": 2321, "txt": "].items():", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[72]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 134, "edu_l1_label": "EDU_O"}, {"txt": "                 arg_desc = (f\"- {param_name}:", "language": "chinese", "position": {"atoms": [{"position_id": 2323, "txt": "                 arg_desc = (", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[73]/span"}, {"position_id": 2325, "txt": "f\"- ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[1]"}, {"position_id": 2327, "txt": "{param_name}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[2]/span"}, {"position_id": 2329, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 135, "edu_l1_label": "EDU_O"}, {"txt": " {param_info.get('description', 'No description')}\"                 )if param_name in self.input_schema.get(\"required\", []):", "language": "chinese", "position": {"atoms": [{"position_id": 2330, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[3]"}, {"position_id": 2332, "txt": "{param_info.get(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[4]/span"}, {"position_id": 2334, "txt": "'description'", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[5]/span/span"}, {"position_id": 2336, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[6]/span"}, {"position_id": 2338, "txt": "'No description'", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[7]/span/span"}, {"position_id": 2340, "txt": ")}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[8]/span"}, {"position_id": 2342, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[74]/span/span[9]"}, {"position_id": 2344, "txt": "                 )", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[75]/span"}, {"position_id": 2346, "txt": "if", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[76]/span/span[1]"}, {"position_id": 2348, "txt": " param_name ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[76]/span/span[1]"}, {"position_id": 2350, "txt": "in", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[76]/span/span[2]"}, {"position_id": 2352, "txt": " self.input_schema.get(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[76]/span/span[2]"}, {"position_id": 2354, "txt": "\"required\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[76]/span/span[3]"}, {"position_id": 2356, "txt": ", []):", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[76]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 136, "edu_l1_label": "EDU_O"}, {"txt": "                     arg_desc += \" (required)\"                 args_desc.append(arg_desc)returnf\"\"\" Tool:", "language": "chinese", "position": {"atoms": [{"position_id": 2358, "txt": "                     arg_desc += ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[77]/span"}, {"position_id": 2360, "txt": "\" (required)\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[77]/span/span"}, {"position_id": 2362, "txt": "                 args_desc.append(arg_desc)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[78]/span"}, {"position_id": 2364, "txt": "return", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[80]/span/span[1]"}, {"position_id": 2366, "txt": "f\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[80]/span/span[2]"}, {"position_id": 2368, "txt": " Tool:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[81]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 137, "edu_l1_label": "EDU_O"}, {"txt": " {self.name} Description:", "language": "chinese", "position": {"atoms": [{"position_id": 2369, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[81]/span"}, {"position_id": 2371, "txt": "{self.name}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[81]/span/span"}, {"position_id": 2373, "txt": " Description:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[82]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 138, "edu_l1_label": "EDU_O"}, {"txt": " {self.description} Arguments:", "language": "chinese", "position": {"atoms": [{"position_id": 2374, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[82]/span"}, {"position_id": 2376, "txt": "{self.description}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[82]/span/span"}, {"position_id": 2378, "txt": " Arguments:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[83]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 139, "edu_l1_label": "EDU_O"}, {"txt": "{chr(10).join(args_desc)} \"\"\"", "language": "chinese", "position": {"atoms": [{"position_id": 2380, "txt": "{", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[84]/span/span[1]"}, {"position_id": 2382, "txt": "chr", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[84]/span/span[2]/span"}, {"position_id": 2384, "txt": "(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[84]/span/span[3]"}, {"position_id": 2386, "txt": "10", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[84]/span/span[4]/span"}, {"position_id": 2388, "txt": ").join(args_desc)}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[84]/span/span[5]"}, {"position_id": 2390, "txt": " \"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[5]/section/section/pre/code[85]/span"}]}, "tags": [], "label": "code", "web_segment_id": 89, "global_sentence_id": 140, "edu_l1_label": "EDU_O"}, {"txt": "那 tool 的描述和代码中的 input_schema 是从哪里来的呢？", "language": "chinese", "position": {"atoms": [{"position_id": 2392, "txt": "那 tool 的描述和代码中的 input_schema 是从哪里来的呢？", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[18]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 90, "global_sentence_id": 141, "edu_l1_label": "IOS"}, {"txt": "通过进一步分析 MCP 的 Python SDK 源代码可以发现：", "language": "chinese", "position": {"atoms": [{"position_id": 2393, "txt": "通过进一步分析 MCP 的 Python SDK 源代码可以发现：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[18]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 90, "global_sentence_id": 142, "edu_l1_label": "IOS"}, {"txt": "大部分情况下，当使用装饰器 @mcp.tool() 来装饰函数时，对应的 name 和 description 等其实直接源自用户定义函数的函数名以及函数的 docstring 等。", "language": "chinese", "position": {"atoms": [{"position_id": 2394, "txt": "大部分情况下，当使用装饰器 @mcp.tool() 来装饰函数时，对应的 name 和 description 等其实直接源自用户定义函数的函数名以及函数的 docstring 等。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[18]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 90, "global_sentence_id": 143, "edu_l1_label": "IOS"}, {"txt": "这里仅截取一小部分片段，想了解更多请参考原始代码。", "language": "chinese", "position": {"atoms": [{"position_id": 2395, "txt": "这里仅截取一小部分片段，想了解更多请参考原始代码。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[18]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 90, "global_sentence_id": 144, "edu_l1_label": "IOS"}, {"txt": "@classmethoddeffrom_function(     cls,     fn:", "language": "chinese", "position": {"atoms": [{"position_id": 2397, "txt": "@classmethod", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[1]/span/span"}, {"position_id": 2399, "txt": "def", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[2]/span/span[1]"}, {"position_id": 2401, "txt": "from_function", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[2]/span/span[2]"}, {"position_id": 2403, "txt": "(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[2]/span/span[2]"}, {"position_id": 2405, "txt": "     cls,", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[3]/span"}, {"position_id": 2407, "txt": "     fn:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[4]/span"}]}, "tags": [], "label": "code", "web_segment_id": 91, "global_sentence_id": 145, "edu_l1_label": "EDU_O"}, {"txt": " Callable,     name:", "language": "chinese", "position": {"atoms": [{"position_id": 2408, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[4]/span"}, {"position_id": 2410, "txt": "Callable", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[4]/span/span"}, {"position_id": 2412, "txt": ",", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[4]/span/span"}, {"position_id": 2414, "txt": "     name:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[5]/span"}]}, "tags": [], "label": "code", "web_segment_id": 91, "global_sentence_id": 146, "edu_l1_label": "EDU_O"}, {"txt": " str | None = None,     description:", "language": "chinese", "position": {"atoms": [{"position_id": 2415, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[5]/span"}, {"position_id": 2417, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[5]/span/span[1]"}, {"position_id": 2419, "txt": " | ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[5]/span/span[1]"}, {"position_id": 2421, "txt": "None", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[5]/span/span[2]"}, {"position_id": 2423, "txt": " = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[5]/span/span[2]"}, {"position_id": 2425, "txt": "None", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[5]/span/span[3]"}, {"position_id": 2427, "txt": ",", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[5]/span/span[3]"}, {"position_id": 2429, "txt": "     description:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[6]/span"}]}, "tags": [], "label": "code", "web_segment_id": 91, "global_sentence_id": 147, "edu_l1_label": "EDU_O"}, {"txt": " str | None = None,     context_kwarg:", "language": "chinese", "position": {"atoms": [{"position_id": 2430, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[6]/span"}, {"position_id": 2432, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[6]/span/span[1]"}, {"position_id": 2434, "txt": " | ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[6]/span/span[1]"}, {"position_id": 2436, "txt": "None", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[6]/span/span[2]"}, {"position_id": 2438, "txt": " = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[6]/span/span[2]"}, {"position_id": 2440, "txt": "None", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[6]/span/span[3]"}, {"position_id": 2442, "txt": ",", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[6]/span/span[3]"}, {"position_id": 2444, "txt": "     context_kwarg:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[7]/span"}]}, "tags": [], "label": "code", "web_segment_id": 91, "global_sentence_id": 148, "edu_l1_label": "EDU_O"}, {"txt": " str | None = None, ) -> \"Tool\":\"\"\"", "language": "chinese", "position": {"atoms": [{"position_id": 2445, "txt": " ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[7]/span"}, {"position_id": 2447, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[7]/span/span[1]"}, {"position_id": 2449, "txt": " | ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[7]/span/span[1]"}, {"position_id": 2451, "txt": "None", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[7]/span/span[2]"}, {"position_id": 2453, "txt": " = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[7]/span/span[2]"}, {"position_id": 2455, "txt": "None", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[7]/span/span[3]"}, {"position_id": 2457, "txt": ",", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[7]/span/span[3]"}, {"position_id": 2459, "txt": " ) -> ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[8]/span"}, {"position_id": 2461, "txt": "\"Tool\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[8]/span/span"}, {"position_id": 2463, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[8]/span/span"}, {"position_id": 2465, "txt": "\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[9]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 91, "global_sentence_id": 149, "edu_l1_label": "EDU_O"}, {"txt": "Create a Tool from a function.\"\"\"     func_name = name or fn.__name__ # 获取函数名if func_name == \"<lambda>\":", "language": "chinese", "position": {"atoms": [{"position_id": 2466, "txt": "Create a Tool from a function.\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[9]/span/span"}, {"position_id": 2468, "txt": "     func_name = name ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[10]/span"}, {"position_id": 2470, "txt": "or", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[10]/span/span[1]"}, {"position_id": 2472, "txt": " fn.__name__ ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[10]/span/span[1]"}, {"position_id": 2474, "txt": "# 获取函数名", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[10]/span/span[2]"}, {"position_id": 2476, "txt": "if", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[12]/span/span[1]"}, {"position_id": 2478, "txt": " func_name == ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[12]/span/span[1]"}, {"position_id": 2480, "txt": "\"<lambda>\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[12]/span/span[2]"}, {"position_id": 2482, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[12]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 91, "global_sentence_id": 150, "edu_l1_label": "EDU_O"}, {"txt": "raise ValueError(\"You must provide a name for lambda functions\")     func_doc = description or fn.__doc__ or\"\"# 获取函数 docstring     is_async = inspect.iscoroutinefunction(fn)     ... # 更多请参考原始代码...", "language": "chinese", "position": {"atoms": [{"position_id": 2484, "txt": "raise", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[13]/span/span[1]"}, {"position_id": 2486, "txt": " ValueError(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[13]/span/span[1]"}, {"position_id": 2488, "txt": "\"You must provide a name for lambda functions\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[13]/span/span[2]"}, {"position_id": 2490, "txt": ")", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[13]/span/span[2]"}, {"position_id": 2492, "txt": "     func_doc = description ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[15]/span"}, {"position_id": 2494, "txt": "or", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[15]/span/span[1]"}, {"position_id": 2496, "txt": " fn.__doc__ ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[15]/span/span[1]"}, {"position_id": 2498, "txt": "or", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[15]/span/span[2]"}, {"position_id": 2500, "txt": "\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[15]/span/span[3]"}, {"position_id": 2502, "txt": "# 获取函数 docstring", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[15]/span/span[4]"}, {"position_id": 2504, "txt": "     is_async = inspect.iscoroutinefunction(fn)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[16]/span"}, {"position_id": 2506, "txt": "     ... ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[18]/span"}, {"position_id": 2508, "txt": "# 更多请参考原始代码...", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[6]/section/section/pre/code[18]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 91, "global_sentence_id": 151, "edu_l1_label": "EDU_O"}, {"txt": "总结：", "language": "chinese", "position": {"atoms": [{"position_id": 2510, "txt": "总结：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[19]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 92, "global_sentence_id": 152, "edu_l1_label": "IOS"}, {"txt": "模型是通过 prompt engineering，即提供所有工具的结构化描述和 few-shot 的 example 来确定该使用哪些工具。", "language": "chinese", "position": {"atoms": [{"position_id": 2511, "txt": "模型是通过 prompt engineering，即", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[19]/span[1]/span/span"}, {"position_id": 2513, "txt": "提供所有工具的结构化描述和 few-shot 的 example 来确定该使用哪些工具", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[19]/span[2]/span/span"}, {"position_id": 2515, "txt": "。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[19]/span[3]/span/span[1]"}]}, "tags": [], "label": "content", "web_segment_id": 92, "global_sentence_id": 153, "edu_l1_label": "IOS"}, {"txt": "另一方面，Anthropic 肯定对 Claude 做了专门的训练，毕竟是自家协议，Claude 更能理解工具的 prompt 以及输出结构化的 tool call json 代码。", "language": "chinese", "position": {"atoms": [{"position_id": 2517, "txt": "另一方面，Anthropic 肯定对 Claude 做了专门的训练，毕竟是自家协议，Claude 更能理解工具的 prompt 以及输出结构化的 tool call json 代码。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[19]/span[3]/span/span[2]"}]}, "tags": [], "label": "content", "web_segment_id": 92, "global_sentence_id": 154, "edu_l1_label": "IOS"}, {"txt": "工具执行与结果反馈机制", "language": "chinese", "position": {"atoms": [{"position_id": 2519, "txt": "工具执行与结果反馈机制", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h2[6]/span/span/span"}]}, "tags": ["h2"], "label": "title1", "web_segment_id": 93, "global_sentence_id": 155, "edu_l1_label": "IOS"}, {"txt": "工具的执行就比较简单和直接了。", "language": "chinese", "position": {"atoms": [{"position_id": 2521, "txt": "工具的执行就比较简单和直接了。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[20]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 94, "global_sentence_id": 156, "edu_l1_label": "IOS"}, {"txt": "承接上一步，我们把 system prompt（指令与工具调用描述）和用户消息一起发送给模型，然后接收模型的回复。", "language": "chinese", "position": {"atoms": [{"position_id": 2522, "txt": "承接上一步，我们把 system prompt（指令与工具调用描述）和用户消息一起发送给模型，然后接收模型的回复。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[20]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 94, "global_sentence_id": 157, "edu_l1_label": "IOS"}, {"txt": "当模型分析用户请求后，它会决定是否需要调用工具：", "language": "chinese", "position": {"atoms": [{"position_id": 2523, "txt": "当模型分析用户请求后，它会决定是否需要调用工具：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[20]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 94, "global_sentence_id": 158, "edu_l1_label": "IOS"}, {"txt": "无需工具时：", "language": "chinese", "position": {"atoms": [{"position_id": 2525, "txt": "无需工具时：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[9]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 95, "global_sentence_id": 159, "edu_l1_label": "IOS"}, {"txt": "模型直接生成自然语言回复。", "language": "chinese", "position": {"atoms": [{"position_id": 2526, "txt": "模型直接生成自然语言回复。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[9]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 95, "global_sentence_id": 160, "edu_l1_label": "IOS"}, {"txt": "需要工具时：", "language": "chinese", "position": {"atoms": [{"position_id": 2528, "txt": "需要工具时：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[9]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 96, "global_sentence_id": 161, "edu_l1_label": "IOS"}, {"txt": "模型输出结构化 JSON 格式的工具调用请求。", "language": "chinese", "position": {"atoms": [{"position_id": 2529, "txt": "模型输出结构化 JSON 格式的工具调用请求。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[9]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 96, "global_sentence_id": 162, "edu_l1_label": "IOS"}, {"txt": "如果回复中包含结构化 JSON 格式的工具调用请求，则客户端会根据这个 json 代码执行对应的工具。", "language": "chinese", "position": {"atoms": [{"position_id": 2531, "txt": "如果回复中包含结构化 JSON 格式的工具调用请求，则客户端会根据这个 json 代码执行对应的工具。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[21]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 97, "global_sentence_id": 163, "edu_l1_label": "IOS"}, {"txt": "具体的实现逻辑都在 process_llm_response 中，代码、逻辑非常简单。", "language": "chinese", "position": {"atoms": [{"position_id": 2532, "txt": "具体的实现逻辑都在 process_llm_response 中，代码、逻辑非常简单。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[21]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 97, "global_sentence_id": 164, "edu_l1_label": "IOS"}, {"txt": "如果模型执行了 tool call，则工具执行的结果 result 会和 system prompt 和用户消息一起重新发送给模型，请求模型生成最终回复。", "language": "chinese", "position": {"atoms": [{"position_id": 2534, "txt": "如果模型执行了 tool call，则工具执行的结果 result 会和 system prompt 和用户消息一起重新发送给模型，请求模型生成最终回复。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[22]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 98, "global_sentence_id": 165, "edu_l1_label": "IOS"}, {"txt": "如果 tool call 的 json 代码存在问题或者模型产生了幻觉怎么办呢？", "language": "chinese", "position": {"atoms": [{"position_id": 2535, "txt": "如果 tool call 的 json 代码存在问题或者模型产生了幻觉怎么办呢？", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[22]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 98, "global_sentence_id": 166, "edu_l1_label": "IOS"}, {"txt": "通过阅读代码 发现，我们会 skip 掉无效的调用请求。", "language": "chinese", "position": {"atoms": [{"position_id": 2536, "txt": "通过阅读代码 发现，我们会 skip 掉无效的调用请求。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[22]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 98, "global_sentence_id": 167, "edu_l1_label": "IOS"}, {"txt": "执行相关的代码与注释如下：", "language": "chinese", "position": {"atoms": [{"position_id": 2537, "txt": "执行相关的代码与注释如下：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[22]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 98, "global_sentence_id": 168, "edu_l1_label": "IOS"}, {"txt": "... # 省略无关的代码asyncdefstart(self):", "language": "chinese", "position": {"atoms": [{"position_id": 2539, "txt": "... ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[1]/span"}, {"position_id": 2541, "txt": "# 省略无关的代码", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[1]/span/span"}, {"position_id": 2543, "txt": "async", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[2]/span/span[1]"}, {"position_id": 2545, "txt": "def", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[2]/span/span[2]"}, {"position_id": 2547, "txt": "start", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[2]/span/span[3]"}, {"position_id": 2549, "txt": "(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[2]/span/span[3]"}, {"position_id": 2551, "txt": "self", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[2]/span/span[4]"}, {"position_id": 2553, "txt": "):", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[2]/span/span[4]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 169, "edu_l1_label": "EDU_O"}, {"txt": "     ... # 上面已经介绍过了，模型如何选择工具whileTrue:", "language": "chinese", "position": {"atoms": [{"position_id": 2555, "txt": "     ... ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[3]/span"}, {"position_id": 2557, "txt": "# 上面已经介绍过了，模型如何选择工具", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[3]/span/span"}, {"position_id": 2559, "txt": "while", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[5]/span/span[1]"}, {"position_id": 2561, "txt": "True", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[5]/span/span[2]"}, {"position_id": 2563, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[5]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 170, "edu_l1_label": "EDU_O"}, {"txt": "# 假设这里已经处理了用户消息输入.", "language": "chinese", "position": {"atoms": [{"position_id": 2565, "txt": "# 假设这里已经处理了用户消息输入.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[6]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 171, "edu_l1_label": "EDU_O"}, {"txt": "         messages.append({\"role\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2567, "txt": "         messages.append({", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span"}, {"position_id": 2569, "txt": "\"role\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span/span[1]"}, {"position_id": 2571, "txt": ": ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span/span[1]"}, {"position_id": 2573, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 172, "edu_l1_label": "EDU_O"}, {"txt": "user\", \"content\":", "language": "chinese", "position": {"atoms": [{"position_id": 2574, "txt": "user\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span/span[2]"}, {"position_id": 2576, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span/span[2]"}, {"position_id": 2578, "txt": "\"content\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span/span[3]"}, {"position_id": 2580, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 173, "edu_l1_label": "EDU_O"}, {"txt": " user_input})# 获取 LLM 的输出         llm_response = self.llm_client.get_response(messages)# 处理 LLM 的输出（如果有 tool call 则执行对应的工具）         result = await self.process_llm_response(llm_response)# 如果 result 与 llm_response 不同，说明执行了 tool call （有额外信息了）# 则将 tool call 的结果重新发送给 LLM 进行处理。", "language": "chinese", "position": {"atoms": [{"position_id": 2581, "txt": " user_input})", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[7]/span/span[3]"}, {"position_id": 2583, "txt": "# 获取 LLM 的输出", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[9]/span/span"}, {"position_id": 2585, "txt": "         llm_response = self.llm_client.get_response(messages)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[10]/span"}, {"position_id": 2587, "txt": "# 处理 LLM 的输出（如果有 tool call 则执行对应的工具）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[12]/span/span"}, {"position_id": 2589, "txt": "         result = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[13]/span"}, {"position_id": 2591, "txt": "await", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[13]/span/span"}, {"position_id": 2593, "txt": " self.process_llm_response(llm_response)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[13]/span/span"}, {"position_id": 2595, "txt": "# 如果 result 与 llm_response 不同，说明执行了 tool call （有额外信息了）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[15]/span/span"}, {"position_id": 2597, "txt": "# 则将 tool call 的结果重新发送给 LLM 进行处理。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[16]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 174, "edu_l1_label": "EDU_O"}, {"txt": "if result != llm_response:", "language": "chinese", "position": {"atoms": [{"position_id": 2599, "txt": "if", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[17]/span/span"}, {"position_id": 2601, "txt": " result != llm_response:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[17]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 175, "edu_l1_label": "EDU_O"}, {"txt": "             messages.append({\"role\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2603, "txt": "             messages.append({", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span"}, {"position_id": 2605, "txt": "\"role\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span/span[1]"}, {"position_id": 2607, "txt": ": ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span/span[1]"}, {"position_id": 2609, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 176, "edu_l1_label": "EDU_O"}, {"txt": "assistant\", \"content\":", "language": "chinese", "position": {"atoms": [{"position_id": 2610, "txt": "assistant\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span/span[2]"}, {"position_id": 2612, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span/span[2]"}, {"position_id": 2614, "txt": "\"content\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span/span[3]"}, {"position_id": 2616, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 177, "edu_l1_label": "EDU_O"}, {"txt": " llm_response})             messages.append({\"role\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2617, "txt": " llm_response})", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[18]/span/span[3]"}, {"position_id": 2619, "txt": "             messages.append({", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span"}, {"position_id": 2621, "txt": "\"role\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span/span[1]"}, {"position_id": 2623, "txt": ": ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span/span[1]"}, {"position_id": 2625, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 178, "edu_l1_label": "EDU_O"}, {"txt": "system\", \"content\":", "language": "chinese", "position": {"atoms": [{"position_id": 2626, "txt": "system\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span/span[2]"}, {"position_id": 2628, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span/span[2]"}, {"position_id": 2630, "txt": "\"content\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span/span[3]"}, {"position_id": 2632, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 179, "edu_l1_label": "EDU_O"}, {"txt": " result})             final_response = self.llm_client.get_response(messages)             logging.info(\"\\nFinal response:", "language": "chinese", "position": {"atoms": [{"position_id": 2633, "txt": " result})", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[19]/span/span[3]"}, {"position_id": 2635, "txt": "             final_response = self.llm_client.get_response(messages)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[21]/span"}, {"position_id": 2637, "txt": "             logging.info(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[22]/span"}, {"position_id": 2639, "txt": "\"\\nFinal response:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[22]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 180, "edu_l1_label": "EDU_O"}, {"txt": " %s\", final_response)             messages.append(                 {\"role\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2640, "txt": " %s\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[22]/span/span"}, {"position_id": 2642, "txt": ", final_response)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[22]/span/span"}, {"position_id": 2644, "txt": "             messages.append(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[23]/span"}, {"position_id": 2646, "txt": "                 {", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span"}, {"position_id": 2648, "txt": "\"role\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span/span[1]"}, {"position_id": 2650, "txt": ": ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span/span[1]"}, {"position_id": 2652, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 181, "edu_l1_label": "EDU_O"}, {"txt": "assistant\", \"content\":", "language": "chinese", "position": {"atoms": [{"position_id": 2653, "txt": "assistant\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span/span[2]"}, {"position_id": 2655, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span/span[2]"}, {"position_id": 2657, "txt": "\"content\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span/span[3]"}, {"position_id": 2659, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 182, "edu_l1_label": "EDU_O"}, {"txt": " final_response}             )# 否则代表没有执行 tool call，则直接将 LLM 的输出返回给用户。", "language": "chinese", "position": {"atoms": [{"position_id": 2660, "txt": " final_response}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[24]/span/span[3]"}, {"position_id": 2662, "txt": "             )", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[25]/span"}, {"position_id": 2664, "txt": "# 否则代表没有执行 tool call，则直接将 LLM 的输出返回给用户。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[26]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 183, "edu_l1_label": "EDU_O"}, {"txt": "else:", "language": "chinese", "position": {"atoms": [{"position_id": 2666, "txt": "else", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[27]/span/span"}, {"position_id": 2668, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[27]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 184, "edu_l1_label": "EDU_O"}, {"txt": "             messages.append({\"role\": \"", "language": "chinese", "position": {"atoms": [{"position_id": 2670, "txt": "             messages.append({", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span"}, {"position_id": 2672, "txt": "\"role\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span/span[1]"}, {"position_id": 2674, "txt": ": ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span/span[1]"}, {"position_id": 2676, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 185, "edu_l1_label": "EDU_O"}, {"txt": "assistant\", \"content\":", "language": "chinese", "position": {"atoms": [{"position_id": 2677, "txt": "assistant\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span/span[2]"}, {"position_id": 2679, "txt": ", ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span/span[2]"}, {"position_id": 2681, "txt": "\"content\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span/span[3]"}, {"position_id": 2683, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 186, "edu_l1_label": "EDU_O"}, {"txt": " llm_response})", "language": "chinese", "position": {"atoms": [{"position_id": 2684, "txt": " llm_response})", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[7]/section/section/pre/code[28]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 99, "global_sentence_id": 187, "edu_l1_label": "EDU_O"}, {"txt": "根据上述原理分析，可以看出工具文档至关重要。", "language": "chinese", "position": {"atoms": [{"position_id": 2686, "txt": "根据上述原理分析，", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[23]/span[1]/span/span"}, {"position_id": 2688, "txt": "可以看出工具文档至关重要", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[23]/span[2]/span/span"}, {"position_id": 2690, "txt": "。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[23]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 100, "global_sentence_id": 188, "edu_l1_label": "IOS"}, {"txt": "模型依赖于工具描述文本来理解和选择适用的工具，这意味着精心编写的工具名称、文档字符串（docstring）以及参数说明显得尤为重要。", "language": "chinese", "position": {"atoms": [{"position_id": 2691, "txt": "模型依赖于工具描述文本来理解和选择适用的工具，这意味着精心编写的工具名称、文档字符串（docstring）以及参数说明显得尤为重要。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[23]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 100, "global_sentence_id": 189, "edu_l1_label": "IOS"}, {"txt": "鉴于MCP的选择机制基于prompt实现，理论上任何模型只要能够提供相应的工具描述就能与MCP兼容使用。", "language": "chinese", "position": {"atoms": [{"position_id": 2692, "txt": "鉴于MCP的选择机制基于prompt实现，理论上任何模型只要能够提供相应的工具描述就能与MCP兼容使用。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[23]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 100, "global_sentence_id": 190, "edu_l1_label": "IOS"}, {"txt": "MCP Server 开发实践", "language": "chinese", "position": {"atoms": [{"position_id": 2694, "txt": "MCP Server 开发实践", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[8]/section/section/p/span"}]}, "tags": [], "label": "content", "web_segment_id": 101, "global_sentence_id": 191, "edu_l1_label": "BOS"}, {"txt": "对绝大部分 AI 开发者来说，除了了解MCP的原理，我们更关心 Server 的实现。", "language": "chinese", "position": {"atoms": [{"position_id": 2696, "txt": "对绝大部分 AI 开发者来说，除了了解MCP的原理，我们更关心 Server 的实现。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[24]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 102, "global_sentence_id": 192, "edu_l1_label": "IOS"}, {"txt": "因此，我这里准备通过一个最简单的示例来介绍如何实现一个 MCP Server。", "language": "chinese", "position": {"atoms": [{"position_id": 2697, "txt": "因此，我这里准备通过一个最简单的示例来介绍如何实现一个 MCP Server。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[24]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 102, "global_sentence_id": 193, "edu_l1_label": "IOS"}, {"txt": "MCP servers 可以提供三种主要类型的功能：", "language": "chinese", "position": {"atoms": [{"position_id": 2698, "txt": "MCP servers 可以提供三种主要类型的功能：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[24]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 102, "global_sentence_id": 194, "edu_l1_label": "IOS"}, {"txt": "Tools（工具）：", "language": "chinese", "position": {"atoms": [{"position_id": 2700, "txt": "Tools（工具）：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[10]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 103, "global_sentence_id": 195, "edu_l1_label": "IOS"}, {"txt": "可以被 LLM 调用的函数或外部服务接口，需要用户授权后执行。", "language": "chinese", "position": {"atoms": [{"position_id": 2701, "txt": "可以被 LLM 调用的函数或外部服务接口，需要用户授权后执行。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[10]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 103, "global_sentence_id": 196, "edu_l1_label": "IOS"}, {"txt": "Resources（资源）：", "language": "chinese", "position": {"atoms": [{"position_id": 2703, "txt": "Resources（资源）：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[10]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 104, "global_sentence_id": 197, "edu_l1_label": "IOS"}, {"txt": "提供类似文件的结构化数据，供LLM读取和分析。", "language": "chinese", "position": {"atoms": [{"position_id": 2704, "txt": "提供类似文件的结构化数据，供LLM读取和分析。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[10]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 104, "global_sentence_id": 198, "edu_l1_label": "IOS"}, {"txt": "如本地文件内容、远程api返回的json数据、数据库查询结果等。", "language": "chinese", "position": {"atoms": [{"position_id": 2705, "txt": "如本地文件内容、远程api返回的json数据、数据库查询结果等。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[10]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 104, "global_sentence_id": 199, "edu_l1_label": "IOS"}, {"txt": "Prompts（提示）：", "language": "chinese", "position": {"atoms": [{"position_id": 2707, "txt": "Prompts（提示）：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[10]/li[3]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 105, "global_sentence_id": 200, "edu_l1_label": "IOS"}, {"txt": "预先编写的模板，帮助用户完成特定任务", "language": "chinese", "position": {"atoms": [{"position_id": 2708, "txt": "预先编写的模板，帮助用户完成特定任务", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[10]/li[3]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 105, "global_sentence_id": 201, "edu_l1_label": "IOS"}, {"txt": "本教程将主要关注工具（Tools）。", "language": "chinese", "position": {"atoms": [{"position_id": 2710, "txt": "本教程将主要关注工具（Tools）。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[25]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 106, "global_sentence_id": 202, "edu_l1_label": "IOS"}, {"txt": "1、使用 LLM 构建 MCP 的最佳实践", "language": "chinese", "position": {"atoms": [{"position_id": 2712, "txt": "1、使用 LLM 构建 MCP 的最佳实践", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h3[1]/span/span/span"}]}, "tags": ["h3"], "label": "title2", "web_segment_id": 107, "global_sentence_id": 203, "edu_l1_label": "IOS"}, {"txt": "在开始之前，Anthropic 为我们提供了一个基于LLM 的 MCP Server 的最佳开发实践（https://modelcontextprotocol.io/tutorials/building-mcp-with-llms），Guide里面特意提到了，该实践是基于Claude，也可以基于其它LLM。", "language": "chinese", "position": {"atoms": [{"position_id": 2714, "txt": "在开始之前，Anthropic 为我们提供了一个基于LLM 的 MCP Server 的最佳开发实践（", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[26]/span[1]/span/span"}, {"position_id": 2716, "txt": "https://modelcontextprotocol.io/tutorials/building-mcp-with-llms", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[26]/span[2]/span/span"}, {"position_id": 2718, "txt": "），Guide里面特意提到了，该实践是基于Claude，也可以基于其它LLM。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[26]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 108, "global_sentence_id": 204, "edu_l1_label": "IOS"}, {"txt": "总结如下：", "language": "chinese", "position": {"atoms": [{"position_id": 2719, "txt": "总结如下：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[26]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 108, "global_sentence_id": 205, "edu_l1_label": "IOS"}, {"txt": "1.引入 domain knowledge （说人话就是，告诉他一些 MCP Server 开发的范例和资料）", "language": "chinese", "position": {"atoms": [{"position_id": 2721, "txt": "1.引入 domain knowledge （说人话就是，告诉他一些 MCP Server 开发的范例和资料）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[27]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 109, "global_sentence_id": 206, "edu_l1_label": "IOS"}, {"txt": "访问 https://modelcontextprotocol.io/llms-full.txt 并复制完整的文档文本。", "language": "chinese", "position": {"atoms": [{"position_id": 2723, "txt": "访问 ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[11]/li[1]/p/span[1]/span/span"}, {"position_id": 2725, "txt": "https://modelcontextprotocol.io/llms-full.txt", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[11]/li[1]/p/span[2]/span/span"}, {"position_id": 2727, "txt": " 并复制完整的文档文本。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[11]/li[1]/p/span[3]/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 110, "global_sentence_id": 207, "edu_l1_label": "IOS"}, {"txt": "（实测这个太长了，可以忽略）", "language": "chinese", "position": {"atoms": [{"position_id": 2728, "txt": "（实测这个太长了，可以忽略）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[11]/li[1]/p/span[3]/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 110, "global_sentence_id": 208, "edu_l1_label": "IOS"}, {"txt": "导航到 MCP TypeScript SDK 或 Python SDK Github 项目中并复制相关内容。", "language": "chinese", "position": {"atoms": [{"position_id": 2730, "txt": "导航到 MCP TypeScript SDK 或 Python SDK Github 项目中并复制相关内容。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[11]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 111, "global_sentence_id": 209, "edu_l1_label": "IOS"}, {"txt": "把这些作为 prompt 输入到你的 chat 对话中（作为 context）。", "language": "chinese", "position": {"atoms": [{"position_id": 2732, "txt": "把这些作为 prompt 输入到你的 chat 对话中（作为 context）。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[11]/li[3]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 112, "global_sentence_id": 210, "edu_l1_label": "IOS"}, {"txt": "2.描述你的需求", "language": "chinese", "position": {"atoms": [{"position_id": 2734, "txt": "2.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[28]/span[1]/span/span"}, {"position_id": 2736, "txt": "描述你的需求", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[28]/span[2]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 113, "global_sentence_id": 211, "edu_l1_label": "IOS"}, {"txt": "你的服务器会开放哪些资源", "language": "chinese", "position": {"atoms": [{"position_id": 2738, "txt": "你的服务器会开放哪些资源", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[12]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 114, "global_sentence_id": 212, "edu_l1_label": "IOS"}, {"txt": "它会提供哪些工具", "language": "chinese", "position": {"atoms": [{"position_id": 2740, "txt": "它会提供哪些工具", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[12]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 115, "global_sentence_id": 213, "edu_l1_label": "IOS"}, {"txt": "它应该给出哪些引导或建议", "language": "chinese", "position": {"atoms": [{"position_id": 2742, "txt": "它应该给出哪些引导或建议", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[12]/li[3]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 116, "global_sentence_id": 214, "edu_l1_label": "IOS"}, {"txt": "它需要跟哪些外部系统互动", "language": "chinese", "position": {"atoms": [{"position_id": 2744, "txt": "它需要跟哪些外部系统互动", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[12]/li[4]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 117, "global_sentence_id": 215, "edu_l1_label": "IOS"}, {"txt": "给出一个 example prompt:", "language": "chinese", "position": {"atoms": [{"position_id": 2746, "txt": "给出一个 example prompt:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[29]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 118, "global_sentence_id": 216, "edu_l1_label": "IOS"}, {"txt": "... （这里是已经引入的 domain knowledge）打造一个 MCP 服务器，它能够：", "language": "chinese", "position": {"atoms": [{"position_id": 2748, "txt": "... （这里是已经引入的 domain knowledge）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[9]/section/section/pre/code[1]/span"}, {"position_id": 2750, "txt": "打造一个 MCP 服务器，它能够：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[9]/section/section/pre/code[3]/span"}]}, "tags": [], "label": "content", "web_segment_id": 119, "global_sentence_id": 217, "edu_l1_label": "IOS"}, {"txt": "- 连接到我公司的 PostgreSQL 数据库- 将表格结构作为资源开放出来- 提供运行只读 SQL 查询的工具- 包含常见数据分析任务的引导", "language": "chinese", "position": {"atoms": [{"position_id": 2752, "txt": "- 连接到我公司的 PostgreSQL 数据库", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[9]/section/section/pre/code[5]/span/span"}, {"position_id": 2754, "txt": "- 将表格结构作为资源开放出来", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[9]/section/section/pre/code[6]/span/span"}, {"position_id": 2756, "txt": "- 提供运行只读 SQL 查询的工具", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[9]/section/section/pre/code[7]/span/span"}, {"position_id": 2758, "txt": "- 包含常见数据分析任务的引导", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[9]/section/section/pre/code[8]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 119, "global_sentence_id": 218, "edu_l1_label": "IOS"}, {"txt": "剩下的部分也很重要，但是偏重于方法论，实践性较弱，这里就不展开了，推荐直接看链接：", "language": "chinese", "position": {"atoms": [{"position_id": 2760, "txt": "剩下的部分也很重要，但是偏重于方法论，实践性较弱，这里就不展开了，推荐直接看链接：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[30]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 120, "global_sentence_id": 219, "edu_l1_label": "IOS"}, {"txt": "https://modelcontextprotocol.io/tutorials/building-mcp-with-llms。", "language": "chinese", "position": {"atoms": [{"position_id": 2762, "txt": "https://modelcontextprotocol.io/tutorials/building-mcp-with-llms。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[30]/span[2]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 120, "global_sentence_id": 220, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 2764, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[30]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 120, "global_sentence_id": 221, "edu_l1_label": "IOS"}, {"txt": "2、手动实践", "language": "chinese", "position": {"atoms": [{"position_id": 2766, "txt": "2、手动实践", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h3[2]/span/span/span"}]}, "tags": ["h3"], "label": "title2", "web_segment_id": 121, "global_sentence_id": 222, "edu_l1_label": "IOS"}, {"txt": "本节内容主要参考了官方文档：", "language": "chinese", "position": {"atoms": [{"position_id": 2768, "txt": "本节内容主要参考了官方文档：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[31]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 122, "global_sentence_id": 223, "edu_l1_label": "IOS"}, {"txt": "Quick Start:", "language": "chinese", "position": {"atoms": [{"position_id": 2769, "txt": "Quick Start:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[31]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 122, "global_sentence_id": 224, "edu_l1_label": "IOS"}, {"txt": " For Server Developers（https://modelcontextprotocol.io/quickstart/server）。", "language": "chinese", "position": {"atoms": [{"position_id": 2770, "txt": " For Server Developers（", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[31]/span[1]/span/span"}, {"position_id": 2772, "txt": "https://modelcontextprotocol.io/quickstart/server", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[31]/span[2]/span/span"}, {"position_id": 2774, "txt": "）。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[31]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 122, "global_sentence_id": 225, "edu_l1_label": "IOS"}, {"txt": "这里准备了一个简单的示例，使用 Python 实现一个 MCP Server，用来统计当前桌面上的 txt 文件数量和获取对应文件的名字（你可以理解为一点用都没有，但是它足够简单，主要是为了难以配置环境的读者提供一个足够短的实践记录）。", "language": "chinese", "position": {"atoms": [{"position_id": 2775, "txt": "这里准备了一个简单的示例，使用 Python 实现一个 MCP Server，用来统计当前桌面上的 txt 文件数量和获取对应文件的名字（你可以理解为一点用都没有，但是它足够简单，主要是为了难以配置环境的读者提供一个足够短的实践记录）。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[31]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 122, "global_sentence_id": 226, "edu_l1_label": "IOS"}, {"txt": "以下实践均运行在我的 MacOS 系统上。", "language": "chinese", "position": {"atoms": [{"position_id": 2776, "txt": "以下实践均运行在我的 MacOS 系统上。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[31]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 122, "global_sentence_id": 227, "edu_l1_label": "IOS"}, {"txt": "Step1.", "language": "chinese", "position": {"atoms": [{"position_id": 2778, "txt": "Step1.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[1]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 123, "global_sentence_id": 228, "edu_l1_label": "IOS"}, {"txt": " 前置工作", "language": "chinese", "position": {"atoms": [{"position_id": 2779, "txt": " 前置工作", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[1]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 123, "global_sentence_id": 229, "edu_l1_label": "IOS"}, {"txt": "安装 Claude Desktop。", "language": "chinese", "position": {"atoms": [{"position_id": 2781, "txt": "安装 Claude Desktop。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[13]/li[1]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 124, "global_sentence_id": 230, "edu_l1_label": "IOS"}, {"txt": "Python 3.10+ 环境", "language": "chinese", "position": {"atoms": [{"position_id": 2783, "txt": "Python 3.10+ 环境", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[13]/li[2]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 125, "global_sentence_id": 231, "edu_l1_label": "IOS"}, {"txt": "Python MCP SDK 1.2.0+", "language": "chinese", "position": {"atoms": [{"position_id": 2785, "txt": "Python MCP SDK 1.2.0+", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[13]/li[3]/p/span/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 126, "global_sentence_id": 232, "edu_l1_label": "IOS"}, {"txt": "Step2.", "language": "chinese", "position": {"atoms": [{"position_id": 2787, "txt": "Step2.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[2]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 127, "global_sentence_id": 233, "edu_l1_label": "IOS"}, {"txt": " 环境配置", "language": "chinese", "position": {"atoms": [{"position_id": 2788, "txt": " 环境配置", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[2]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 127, "global_sentence_id": 234, "edu_l1_label": "IOS"}, {"txt": "# 安装 uvcurl -LsSf https://astral.sh/uv/install.sh | sh# 创建项目目录uv init txt_countercd txt_counter# 设置 Python 3.10+ 环境echo\"3.11\" > .python-version# 创建虚拟环境并激活uv venvsource .venv/bin/activate# Install dependenciesuv add \"mcp[cli]\" httpx# Create our server filetouch txt_counter.py", "language": "chinese", "position": {"atoms": [{"position_id": 2790, "txt": "# 安装 uv", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[1]/span/span"}, {"position_id": 2792, "txt": "curl -LsSf https://astral.sh/uv/install.sh | sh", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[2]/span"}, {"position_id": 2794, "txt": "# 创建项目目录", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[4]/span/span"}, {"position_id": 2796, "txt": "uv init txt_counter", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[5]/span"}, {"position_id": 2798, "txt": "cd", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[6]/span/span"}, {"position_id": 2800, "txt": " txt_counter", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[6]/span/span"}, {"position_id": 2802, "txt": "# 设置 Python 3.10+ 环境", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[8]/span/span"}, {"position_id": 2804, "txt": "echo", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[9]/span/span[1]"}, {"position_id": 2806, "txt": "\"3.11\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[9]/span/span[2]"}, {"position_id": 2808, "txt": " > .python-version", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[9]/span/span[2]"}, {"position_id": 2810, "txt": "# 创建虚拟环境并激活", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[11]/span/span"}, {"position_id": 2812, "txt": "uv venv", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[12]/span"}, {"position_id": 2814, "txt": "source", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[13]/span/span"}, {"position_id": 2816, "txt": " .venv/bin/activate", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[13]/span/span"}, {"position_id": 2818, "txt": "# Install dependencies", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[15]/span/span"}, {"position_id": 2820, "txt": "uv add ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[16]/span"}, {"position_id": 2822, "txt": "\"mcp[cli]\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[16]/span/span"}, {"position_id": 2824, "txt": " httpx", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[16]/span/span"}, {"position_id": 2826, "txt": "# Create our server file", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[18]/span/span"}, {"position_id": 2828, "txt": "touch", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[19]/span/span"}, {"position_id": 2830, "txt": " txt_counter.py", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[10]/section/section/pre/code[19]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 128, "global_sentence_id": 235, "edu_l1_label": "EDU_O"}, {"txt": "Question:", "language": "chinese", "position": {"atoms": [{"position_id": 2832, "txt": "Question:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/blockquote/p[1]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 129, "global_sentence_id": 236, "edu_l1_label": "IOS"}, {"txt": " 什么是 uv 呢和 conda 比有什么区别？", "language": "chinese", "position": {"atoms": [{"position_id": 2833, "txt": " 什么是 uv 呢和 conda 比有什么区别？", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/blockquote/p[1]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 129, "global_sentence_id": 237, "edu_l1_label": "IOS"}, {"txt": "Answer:", "language": "chinese", "position": {"atoms": [{"position_id": 2835, "txt": "Answer:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/blockquote/p[2]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 130, "global_sentence_id": 238, "edu_l1_label": "IOS"}, {"txt": " 一个用 Rust 编写的超快速 (100x) Python 包管理器和环境管理工具，由 Astral 开发。", "language": "chinese", "position": {"atoms": [{"position_id": 2836, "txt": " 一个用 Rust 编写的超快速 (100x) Python 包管理器和环境管理工具，由 Astral 开发。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/blockquote/p[2]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 130, "global_sentence_id": 239, "edu_l1_label": "IOS"}, {"txt": "定位为 pip 和 venv 的替代品，专注于速度、简单性和现代 Python 工作流。", "language": "chinese", "position": {"atoms": [{"position_id": 2837, "txt": "定位为 pip 和 venv 的替代品，专注于速度、简单性和现代 Python 工作流。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/blockquote/p[2]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 130, "global_sentence_id": 240, "edu_l1_label": "IOS"}, {"txt": "Step3.", "language": "chinese", "position": {"atoms": [{"position_id": 2839, "txt": "Step3.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[3]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 131, "global_sentence_id": 241, "edu_l1_label": "IOS"}, {"txt": " 构造一个 prompt", "language": "chinese", "position": {"atoms": [{"position_id": 2840, "txt": " 构造一个 prompt", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[3]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 131, "global_sentence_id": 242, "edu_l1_label": "IOS"}, {"txt": "\"\"\"... （这里是已经引入的 domain knowledge）\"\"\"打造一个 MCP 服务器，它能够：", "language": "chinese", "position": {"atoms": [{"position_id": 2842, "txt": "\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[1]/span/span"}, {"position_id": 2844, "txt": "... ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[2]/span/span"}, {"position_id": 2846, "txt": "（这里是已经引入的 domain knowledge）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[2]/span/span"}, {"position_id": 2848, "txt": "\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[3]/span"}, {"position_id": 2850, "txt": "打造一个 MCP 服务器，它能够：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[5]/span"}]}, "tags": [], "label": "content", "web_segment_id": 132, "global_sentence_id": 243, "edu_l1_label": "IOS"}, {"txt": "- 功能：", "language": "chinese", "position": {"atoms": [{"position_id": 2852, "txt": "- 功能：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[6]/span"}]}, "tags": [], "label": "content", "web_segment_id": 132, "global_sentence_id": 244, "edu_l1_label": "IOS"}, {"txt": "    - 统计当前桌面上的 txt 文件数量    - 获取对应文件的名字要求：", "language": "chinese", "position": {"atoms": [{"position_id": 2854, "txt": "    - 统计当前桌面上的 txt 文件数量", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[7]/span"}, {"position_id": 2856, "txt": "    - 获取对应文件的名字", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[8]/span"}, {"position_id": 2858, "txt": "要求：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[10]/span"}]}, "tags": [], "label": "content", "web_segment_id": 132, "global_sentence_id": 245, "edu_l1_label": "IOS"}, {"txt": "- 不需要给出 prompt 和 resource 相关代码。", "language": "chinese", "position": {"atoms": [{"position_id": 2860, "txt": "- 不需要给出 prompt 和 resource 相关代码。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[11]/span"}]}, "tags": [], "label": "content", "web_segment_id": 132, "global_sentence_id": 246, "edu_l1_label": "IOS"}, {"txt": "- 你可以假设我的桌面路径为 /Users/{username}/Desktop", "language": "chinese", "position": {"atoms": [{"position_id": 2862, "txt": "- 你可以假设我的桌面路径为 /Users/{username}/Desktop", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[11]/section/section/pre/code[12]/span"}]}, "tags": [], "label": "content", "web_segment_id": 132, "global_sentence_id": 247, "edu_l1_label": "IOS"}, {"txt": "Domain Knowledge 复制于 MCP Python SDK的README文件（https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/refs/heads/main/README.md）", "language": "chinese", "position": {"atoms": [{"position_id": 2864, "txt": "Domain Knowledge 复制于 MCP Python SDK的README文件（", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[32]/span[1]/span/span"}, {"position_id": 2866, "txt": "https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/refs/heads/main/README.md", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[32]/span[2]/span/span"}, {"position_id": 2868, "txt": "）", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[32]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 133, "global_sentence_id": 248, "edu_l1_label": "IOS"}, {"txt": "Step4.", "language": "chinese", "position": {"atoms": [{"position_id": 2870, "txt": "Step4.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[4]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 134, "global_sentence_id": 249, "edu_l1_label": "IOS"}, {"txt": " 实现 MCP Server", "language": "chinese", "position": {"atoms": [{"position_id": 2871, "txt": " 实现 MCP Server", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[4]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 134, "global_sentence_id": 250, "edu_l1_label": "IOS"}, {"txt": "以下代码由 Claude 3.7 直接生成。", "language": "chinese", "position": {"atoms": [{"position_id": 2873, "txt": "以下代码由 Claude 3.7 直接生成。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[33]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 135, "global_sentence_id": 251, "edu_l1_label": "IOS"}, {"txt": "当然这里主要是因为需求足够简单，当需要实现一个复杂的 MCP Server 时，可能需要多步的引导和 Debug 才能得到最终的代码。", "language": "chinese", "position": {"atoms": [{"position_id": 2874, "txt": "当然这里主要是因为需求足够简单，当需要实现一个复杂的 MCP Server 时，可能需要多步的引导和 Debug 才能得到最终的代码。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[33]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 135, "global_sentence_id": 252, "edu_l1_label": "IOS"}, {"txt": "import osfrom pathlib import Pathfrom mcp.server.fastmcp import FastMCP# 创建 MCP Servermcp = FastMCP(\"桌面 TXT 文件统计器\")@mcp.tool()defcount_desktop_txt_files() -> int:\"\"\"", "language": "chinese", "position": {"atoms": [{"position_id": 2876, "txt": "import", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[1]/span/span"}, {"position_id": 2878, "txt": " os", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[1]/span/span"}, {"position_id": 2880, "txt": "from", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[2]/span/span[1]"}, {"position_id": 2882, "txt": " pathlib ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[2]/span/span[1]"}, {"position_id": 2884, "txt": "import", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[2]/span/span[2]"}, {"position_id": 2886, "txt": " Path", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[2]/span/span[2]"}, {"position_id": 2888, "txt": "from", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[3]/span/span[1]"}, {"position_id": 2890, "txt": " mcp.server.fastmcp ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[3]/span/span[1]"}, {"position_id": 2892, "txt": "import", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[3]/span/span[2]"}, {"position_id": 2894, "txt": " FastMCP", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[3]/span/span[2]"}, {"position_id": 2896, "txt": "# 创建 MCP Server", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[5]/span/span"}, {"position_id": 2898, "txt": "mcp = FastMCP(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[6]/span"}, {"position_id": 2900, "txt": "\"桌面 TXT 文件统计器\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[6]/span/span"}, {"position_id": 2902, "txt": ")", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[6]/span/span"}, {"position_id": 2904, "txt": "@mcp.tool()", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[8]/span/span"}, {"position_id": 2906, "txt": "def", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[9]/span/span[1]"}, {"position_id": 2908, "txt": "count_desktop_txt_files", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[9]/span/span[2]"}, {"position_id": 2910, "txt": "() -> ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[9]/span/span[2]"}, {"position_id": 2912, "txt": "int", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[9]/span/span[3]"}, {"position_id": 2914, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[9]/span/span[3]"}, {"position_id": 2916, "txt": "\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[10]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 136, "global_sentence_id": 253, "edu_l1_label": "EDU_O"}, {"txt": "Count the number of .txt files on the desktop.\"\"\"# Get the desktop path    username = os.getenv(\"USER\") or os.getenv(\"USERNAME\")    desktop_path = Path(f\"/Users/{username}/Desktop\")# Count .txt files    txt_files = list(desktop_path.glob(\"*.txt\"))returnlen(txt_files)@mcp.tool()deflist_desktop_txt_files() -> str:\"\"\"", "language": "chinese", "position": {"atoms": [{"position_id": 2917, "txt": "Count the number of .txt files on the desktop.\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[10]/span/span"}, {"position_id": 2919, "txt": "# Get the desktop path", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[11]/span/span"}, {"position_id": 2921, "txt": "    username = os.getenv(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[12]/span"}, {"position_id": 2923, "txt": "\"USER\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[12]/span/span[1]"}, {"position_id": 2925, "txt": ") ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[12]/span/span[1]"}, {"position_id": 2927, "txt": "or", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[12]/span/span[2]"}, {"position_id": 2929, "txt": " os.getenv(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[12]/span/span[2]"}, {"position_id": 2931, "txt": "\"USERNAME\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[12]/span/span[3]"}, {"position_id": 2933, "txt": ")", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[12]/span/span[3]"}, {"position_id": 2935, "txt": "    desktop_path = Path(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[13]/span"}, {"position_id": 2937, "txt": "f\"/Users/", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[13]/span/span[1]"}, {"position_id": 2939, "txt": "{username}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[13]/span/span[2]/span"}, {"position_id": 2941, "txt": "/Desktop\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[13]/span/span[3]"}, {"position_id": 2943, "txt": ")", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[13]/span/span[3]"}, {"position_id": 2945, "txt": "# Count .txt files", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[15]/span/span"}, {"position_id": 2947, "txt": "    txt_files = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[16]/span"}, {"position_id": 2949, "txt": "list", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[16]/span/span[1]"}, {"position_id": 2951, "txt": "(desktop_path.glob(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[16]/span/span[1]"}, {"position_id": 2953, "txt": "\"*.txt\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[16]/span/span[2]"}, {"position_id": 2955, "txt": "))", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[16]/span/span[2]"}, {"position_id": 2957, "txt": "return", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[17]/span/span[1]"}, {"position_id": 2959, "txt": "len", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[17]/span/span[2]"}, {"position_id": 2961, "txt": "(txt_files)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[17]/span/span[2]"}, {"position_id": 2963, "txt": "@mcp.tool()", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[19]/span/span"}, {"position_id": 2965, "txt": "def", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[20]/span/span[1]"}, {"position_id": 2967, "txt": "list_desktop_txt_files", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[20]/span/span[2]"}, {"position_id": 2969, "txt": "() -> ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[20]/span/span[2]"}, {"position_id": 2971, "txt": "str", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[20]/span/span[3]"}, {"position_id": 2973, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[20]/span/span[3]"}, {"position_id": 2975, "txt": "\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[21]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 136, "global_sentence_id": 254, "edu_l1_label": "EDU_O"}, {"txt": "Get a list of all .txt filenames on the desktop.\"\"\"# Get the desktop path    username = os.getenv(\"USER\") or os.getenv(\"USERNAME\")    desktop_path = Path(f\"/Users/{username}/Desktop\")# Get all .txt files    txt_files = list(desktop_path.glob(\"*.txt\"))# Return the filenamesifnot txt_files:", "language": "chinese", "position": {"atoms": [{"position_id": 2976, "txt": "Get a list of all .txt filenames on the desktop.\"\"\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[21]/span/span"}, {"position_id": 2978, "txt": "# Get the desktop path", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[22]/span/span"}, {"position_id": 2980, "txt": "    username = os.getenv(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[23]/span"}, {"position_id": 2982, "txt": "\"USER\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[23]/span/span[1]"}, {"position_id": 2984, "txt": ") ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[23]/span/span[1]"}, {"position_id": 2986, "txt": "or", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[23]/span/span[2]"}, {"position_id": 2988, "txt": " os.getenv(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[23]/span/span[2]"}, {"position_id": 2990, "txt": "\"USERNAME\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[23]/span/span[3]"}, {"position_id": 2992, "txt": ")", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[23]/span/span[3]"}, {"position_id": 2994, "txt": "    desktop_path = Path(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[24]/span"}, {"position_id": 2996, "txt": "f\"/Users/", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[24]/span/span[1]"}, {"position_id": 2998, "txt": "{username}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[24]/span/span[2]/span"}, {"position_id": 3000, "txt": "/Desktop\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[24]/span/span[3]"}, {"position_id": 3002, "txt": ")", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[24]/span/span[3]"}, {"position_id": 3004, "txt": "# Get all .txt files", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[26]/span/span"}, {"position_id": 3006, "txt": "    txt_files = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[27]/span"}, {"position_id": 3008, "txt": "list", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[27]/span/span[1]"}, {"position_id": 3010, "txt": "(desktop_path.glob(", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[27]/span/span[1]"}, {"position_id": 3012, "txt": "\"*.txt\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[27]/span/span[2]"}, {"position_id": 3014, "txt": "))", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[27]/span/span[2]"}, {"position_id": 3016, "txt": "# Return the filenames", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[29]/span/span"}, {"position_id": 3018, "txt": "if", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[30]/span/span[1]"}, {"position_id": 3020, "txt": "not", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[30]/span/span[2]"}, {"position_id": 3022, "txt": " txt_files:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[30]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 136, "global_sentence_id": 255, "edu_l1_label": "EDU_O"}, {"txt": "return\"No .txt files found on desktop.\"# Format the list of filenames    file_list = \"\\n\".join([f\"- {file.name}\"for file in txt_files])returnf\"Found {len(txt_files)} .txt files on desktop:", "language": "chinese", "position": {"atoms": [{"position_id": 3024, "txt": "return", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[31]/span/span[1]"}, {"position_id": 3026, "txt": "\"No .txt files found on desktop.\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[31]/span/span[2]"}, {"position_id": 3028, "txt": "# Format the list of filenames", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[33]/span/span"}, {"position_id": 3030, "txt": "    file_list = ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span"}, {"position_id": 3032, "txt": "\"\\n\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[1]"}, {"position_id": 3034, "txt": ".join([", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[1]"}, {"position_id": 3036, "txt": "f\"- ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[2]"}, {"position_id": 3038, "txt": "{file.name}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[3]/span"}, {"position_id": 3040, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[4]"}, {"position_id": 3042, "txt": "for", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[5]"}, {"position_id": 3044, "txt": " file ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[5]"}, {"position_id": 3046, "txt": "in", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[6]"}, {"position_id": 3048, "txt": " txt_files])", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[34]/span/span[6]"}, {"position_id": 3050, "txt": "return", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[1]"}, {"position_id": 3052, "txt": "f\"Found ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[2]"}, {"position_id": 3054, "txt": "{", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[3]/span"}, {"position_id": 3056, "txt": "len", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[4]/span/span"}, {"position_id": 3058, "txt": "(txt_files)}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[5]/span"}, {"position_id": 3060, "txt": " .txt files on desktop:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[6]"}]}, "tags": [], "label": "code", "web_segment_id": 136, "global_sentence_id": 256, "edu_l1_label": "EDU_O"}, {"txt": "\\n{file_list}\"if __name__ == \"__main__\":", "language": "chinese", "position": {"atoms": [{"position_id": 3061, "txt": "\\n", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[6]"}, {"position_id": 3063, "txt": "{file_list}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[7]/span"}, {"position_id": 3065, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[35]/span/span[8]"}, {"position_id": 3067, "txt": "if", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[37]/span/span[1]"}, {"position_id": 3069, "txt": " __name__ == ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[37]/span/span[1]"}, {"position_id": 3071, "txt": "\"__main__\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[37]/span/span[2]"}, {"position_id": 3073, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[37]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 136, "global_sentence_id": 257, "edu_l1_label": "EDU_O"}, {"txt": "# Initialize and run the server    mcp.run()", "language": "chinese", "position": {"atoms": [{"position_id": 3075, "txt": "# Initialize and run the server", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[38]/span/span"}, {"position_id": 3077, "txt": "    mcp.run()", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[12]/section/section/pre/code[39]/span"}]}, "tags": [], "label": "code", "web_segment_id": 136, "global_sentence_id": 258, "edu_l1_label": "EDU_O"}, {"txt": "任务非常简单，只需要调用非常基本的os就可以完成。", "language": "chinese", "position": {"atoms": [{"position_id": 3079, "txt": "任务非常简单，只需要调用非常基本的os就可以完成。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[34]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 137, "global_sentence_id": 259, "edu_l1_label": "IOS"}, {"txt": "Step5.", "language": "chinese", "position": {"atoms": [{"position_id": 3081, "txt": "Step5.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[5]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 138, "global_sentence_id": 260, "edu_l1_label": "IOS"}, {"txt": " 测试 MCP Server", "language": "chinese", "position": {"atoms": [{"position_id": 3082, "txt": " 测试 MCP Server", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[5]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 138, "global_sentence_id": 261, "edu_l1_label": "IOS"}, {"txt": "$ mcp dev txt_counter.pyStarting MCP inspector...Proxy server listening on port 3000MCP Inspector is up and running at http://localhost:", "language": "chinese", "position": {"atoms": [{"position_id": 3084, "txt": "$ mcp dev txt_counter.py", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[1]/span"}, {"position_id": 3086, "txt": "Starting MCP inspector...", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[2]/span"}, {"position_id": 3088, "txt": "Proxy server listening ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[3]/span"}, {"position_id": 3090, "txt": "on", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[3]/span/span[1]"}, {"position_id": 3092, "txt": " port ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[3]/span/span[1]"}, {"position_id": 3094, "txt": "3000", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[3]/span/span[2]"}, {"position_id": 3096, "txt": "MCP Inspector ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[5]/span"}, {"position_id": 3098, "txt": "is", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[5]/span/span[1]"}, {"position_id": 3100, "txt": " up ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[5]/span/span[1]"}, {"position_id": 3102, "txt": "and", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[5]/span/span[2]"}, {"position_id": 3104, "txt": " running at http:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[5]/span/span[2]"}, {"position_id": 3106, "txt": "//localhost:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[5]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 139, "global_sentence_id": 262, "edu_l1_label": "EDU_O"}, {"txt": "5173", "language": "chinese", "position": {"atoms": [{"position_id": 3107, "txt": "5173", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[13]/section/section/pre/code[5]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 139, "global_sentence_id": 263, "edu_l1_label": "EDU_O"}, {"txt": "之后进入到给出的链接中，你大概能按下图进行操作：", "language": "chinese", "position": {"atoms": [{"position_id": 3109, "txt": "之后进入到给出的链接中，你大概能按下图进行操作：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[35]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 140, "global_sentence_id": 264, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3111, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[36]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 141, "global_sentence_id": 265, "edu_l1_label": "EDU_O"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/1DS3T435hGZL1vaSc32QCoLN.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 1475, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/1DS3T435hGZL1vaSc32QCoLN.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[36]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 141, "global_sentence_id": 266, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3113, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[36]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 141, "global_sentence_id": 267, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3115, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[37]/span/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 142, "global_sentence_id": 268, "edu_l1_label": "EDU_O"}, {"txt": "Step6.", "language": "chinese", "position": {"atoms": [{"position_id": 3117, "txt": "Step6.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[6]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 143, "global_sentence_id": 269, "edu_l1_label": "IOS"}, {"txt": " 接入 Claude", "language": "chinese", "position": {"atoms": [{"position_id": 3118, "txt": " 接入 Claude", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[6]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 143, "global_sentence_id": 270, "edu_l1_label": "IOS"}, {"txt": "最后一步就是把我们写好的 MCP 接入到 Claude Desktop 中。", "language": "chinese", "position": {"atoms": [{"position_id": 3120, "txt": "最后一步就是把我们写好的 MCP 接入到 Claude Desktop 中。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[38]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 144, "global_sentence_id": 271, "edu_l1_label": "IOS"}, {"txt": "流程如下：", "language": "chinese", "position": {"atoms": [{"position_id": 3121, "txt": "流程如下：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[38]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 144, "global_sentence_id": 272, "edu_l1_label": "IOS"}, {"txt": "# 打开 claude_desktop_config.json (MacOS / Linux)# 如果你用的是 cursor 或者 vim 请更换对应的命令code ~/Library/Application\\ Support/Claude/claude_desktop_config.json", "language": "chinese", "position": {"atoms": [{"position_id": 3123, "txt": "# 打开 claude_desktop_config.json (MacOS / Linux)", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[14]/section/section/pre/code[1]/span/span"}, {"position_id": 3125, "txt": "# 如果你用的是 cursor 或者 vim 请更换对应的命令", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[14]/section/section/pre/code[2]/span/span"}, {"position_id": 3127, "txt": "code ~/Library/Application\\ Support/Claude/claude_desktop_config.json", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[14]/section/section/pre/code[3]/span"}]}, "tags": [], "label": "code", "web_segment_id": 145, "global_sentence_id": 273, "edu_l1_label": "EDU_O"}, {"txt": "在配置文件中添加以下内容，记得替换相关路径为实际路径。", "language": "chinese", "position": {"atoms": [{"position_id": 3129, "txt": "在配置文件中添加以下内容，记得替换相关路径为实际路径。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[39]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 146, "global_sentence_id": 274, "edu_l1_label": "IOS"}, {"txt": "{\"mcpServers\":", "language": "chinese", "position": {"atoms": [{"position_id": 3131, "txt": "{", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[1]/span/span"}, {"position_id": 3133, "txt": "\"mcpServers\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[2]/span/span[1]"}, {"position_id": 3135, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[2]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 147, "global_sentence_id": 275, "edu_l1_label": "EDU_O"}, {"txt": "{\"txt_counter\":", "language": "chinese", "position": {"atoms": [{"position_id": 3137, "txt": "{", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[2]/span/span[3]"}, {"position_id": 3139, "txt": "\"txt_counter\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[3]/span/span[1]"}, {"position_id": 3141, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[3]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 147, "global_sentence_id": 276, "edu_l1_label": "EDU_O"}, {"txt": "{\"command\":\"", "language": "chinese", "position": {"atoms": [{"position_id": 3143, "txt": "{", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[3]/span/span[3]"}, {"position_id": 3145, "txt": "\"command\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[4]/span/span[1]"}, {"position_id": 3147, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[4]/span/span[2]"}, {"position_id": 3149, "txt": "\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[4]/span/span[3]"}]}, "tags": [], "label": "code", "web_segment_id": 147, "global_sentence_id": 277, "edu_l1_label": "EDU_O"}, {"txt": "/opt/homebrew/bin/uv\",\"args\":", "language": "chinese", "position": {"atoms": [{"position_id": 3150, "txt": "/opt/homebrew/bin/uv\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[4]/span/span[3]"}, {"position_id": 3152, "txt": ",", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[4]/span/span[4]"}, {"position_id": 3154, "txt": "\"args\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[5]/span/span[1]"}, {"position_id": 3156, "txt": ":", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[5]/span/span[2]"}]}, "tags": [], "label": "code", "web_segment_id": 147, "global_sentence_id": 278, "edu_l1_label": "EDU_O"}, {"txt": "[\"--directory\",\"/Users/yangfan/mcp/txt_counter\",\"run\",\"txt_counter.py\"]}}}", "language": "chinese", "position": {"atoms": [{"position_id": 3158, "txt": "[", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[5]/span/span[3]"}, {"position_id": 3160, "txt": "\"--directory\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[6]/span/span[1]"}, {"position_id": 3162, "txt": ",", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[6]/span/span[2]"}, {"position_id": 3164, "txt": "\"/Users/yangfan/mcp/txt_counter\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[7]/span/span[1]"}, {"position_id": 3166, "txt": ",", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[7]/span/span[2]"}, {"position_id": 3168, "txt": "\"run\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[8]/span/span[1]"}, {"position_id": 3170, "txt": ",", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[8]/span/span[2]"}, {"position_id": 3172, "txt": "\"txt_counter.py\"", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[9]/span/span"}, {"position_id": 3174, "txt": "]", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[10]/span/span"}, {"position_id": 3176, "txt": "}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[11]/span/span"}, {"position_id": 3178, "txt": "}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[12]/span/span"}, {"position_id": 3180, "txt": "}", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[15]/section/section/pre/code[13]/span/span"}]}, "tags": [], "label": "code", "web_segment_id": 147, "global_sentence_id": 279, "edu_l1_label": "EDU_O"}, {"txt": "uv最好是绝对路径，推荐使用 which uv 获取。", "language": "chinese", "position": {"atoms": [{"position_id": 3182, "txt": "uv", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[40]/code[1]/span/span/span"}, {"position_id": 3184, "txt": "最好是绝对路径，推荐使用 ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[40]/span[1]/span/span"}, {"position_id": 3186, "txt": "which uv", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[40]/code[2]/span/span/span"}, {"position_id": 3188, "txt": " 获取。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[40]/span[2]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 148, "global_sentence_id": 280, "edu_l1_label": "IOS"}, {"txt": "配置好后重启 Claude Desktop，如果没问题就能看到对应的 MCP Server 了。", "language": "chinese", "position": {"atoms": [{"position_id": 3190, "txt": "配置好后重启 Claude Desktop，如果没问题就能看到对应的 MCP Server 了。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[41]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 149, "global_sentence_id": 281, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3192, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[42]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 150, "global_sentence_id": 282, "edu_l1_label": "EDU_O"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/2mvEFa1upR5D4xMlta2h8JyT.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 1608, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/2mvEFa1upR5D4xMlta2h8JyT.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[42]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 150, "global_sentence_id": 283, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3194, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[42]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 150, "global_sentence_id": 284, "edu_l1_label": "EDU_O"}, {"txt": "Step7.", "language": "chinese", "position": {"atoms": [{"position_id": 3196, "txt": "Step7.", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[7]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 151, "global_sentence_id": 285, "edu_l1_label": "IOS"}, {"txt": " 实际使用", "language": "chinese", "position": {"atoms": [{"position_id": 3197, "txt": " 实际使用", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h4[7]/span/span/span"}]}, "tags": ["h4"], "label": "title3", "web_segment_id": 151, "global_sentence_id": 286, "edu_l1_label": "IOS"}, {"txt": "接下来，我们通过一个简单的 prompt 进行实际测试：", "language": "chinese", "position": {"atoms": [{"position_id": 3199, "txt": "接下来，我们通过一个简单的 prompt 进行实际测试：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[43]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 152, "global_sentence_id": 287, "edu_l1_label": "IOS"}, {"txt": "能推测我当前桌面上 txt 文件名的含义吗？", "language": "chinese", "position": {"atoms": [{"position_id": 3201, "txt": "能推测我当前桌面上 txt 文件名的含义吗？", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[16]/section/section/pre/code/span"}]}, "tags": [], "label": "content", "web_segment_id": 153, "global_sentence_id": 288, "edu_l1_label": "IOS"}, {"txt": "它可能会请求你的使用权限，如图一所示，你可以点击 Allow for This Chat", "language": "chinese", "position": {"atoms": [{"position_id": 3203, "txt": "它可能会请求你的使用权限，如图一所示，你可以点击 ", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[44]/span/span/span"}, {"position_id": 3205, "txt": "Allow for This Chat", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[44]/code/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 154, "global_sentence_id": 289, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3207, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[45]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 155, "global_sentence_id": 290, "edu_l1_label": "EDU_O"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/qdEe0tHtRw24eeG32aZX0Y.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 1645, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/qdEe0tHtRw24eeG32aZX0Y.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[45]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 155, "global_sentence_id": 291, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3209, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[45]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 155, "global_sentence_id": 292, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3211, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[46]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 156, "global_sentence_id": 293, "edu_l1_label": "EDU_O"}, {"txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/AY1hsLRNTuyn53122264Z.jpeg", "language": "chinese", "position": {"atoms": [{"position_id": 1658, "txt": "<img https://wcd-image-bucket-test.oss-cn-zhangjiakou.aliyuncs.com/raw/AY1hsLRNTuyn53122264Z.jpeg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[46]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "figure", "web_segment_id": 156, "global_sentence_id": 294, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3213, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[46]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 156, "global_sentence_id": 295, "edu_l1_label": "EDU_O"}, {"txt": "看起来我们 MCP Server 已经正常工作了！", "language": "chinese", "position": {"atoms": [{"position_id": 3215, "txt": "看起来我们 MCP Server 已经正常工作了！", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[47]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 157, "global_sentence_id": 296, "edu_l1_label": "IOS"}, {"txt": "3、MCP Server Debug", "language": "chinese", "position": {"atoms": [{"position_id": 3217, "txt": "3、MCP Server Debug", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/h3[3]/span/span/span"}]}, "tags": ["h3"], "label": "title2", "web_segment_id": 158, "global_sentence_id": 297, "edu_l1_label": "IOS"}, {"txt": "Debug 是一个非常复杂的话题，这里直接推荐官方的教程：", "language": "chinese", "position": {"atoms": [{"position_id": 3219, "txt": "Debug 是一个非常复杂的话题，这里直接推荐官方的教程：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[48]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 159, "global_sentence_id": 298, "edu_l1_label": "IOS"}, {"txt": "Official Tutorial:", "language": "chinese", "position": {"atoms": [{"position_id": 3221, "txt": "Official Tutorial:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[1]/p/span[1]/span[1]/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 160, "global_sentence_id": 299, "edu_l1_label": "IOS"}, {"txt": " Debugging：", "language": "chinese", "position": {"atoms": [{"position_id": 3222, "txt": " Debugging：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[1]/p/span[1]/span[1]/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 160, "global_sentence_id": 300, "edu_l1_label": "IOS"}, {"txt": "https://modelcontextprotocol.io/docs/tools/debugging﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3224, "txt": "https://modelcontextprotocol.io/docs/tools/debugging", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[1]/p/span[1]/span[2]/span"}, {"position_id": 3226, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[1]/p/span[2]/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 160, "global_sentence_id": 301, "edu_l1_label": "IOS"}, {"txt": "﻿Official Tutorial:", "language": "chinese", "position": {"atoms": [{"position_id": 3228, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[2]/p/span[1]/span/span"}, {"position_id": 3230, "txt": "Official Tutorial:", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[2]/p/span[2]/span[1]/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 161, "global_sentence_id": 302, "edu_l1_label": "IOS"}, {"txt": " Inspector：", "language": "chinese", "position": {"atoms": [{"position_id": 3231, "txt": " Inspector：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[2]/p/span[2]/span[1]/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 161, "global_sentence_id": 303, "edu_l1_label": "IOS"}, {"txt": "https://modelcontextprotocol.io/docs/tools/inspector﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3233, "txt": "https://modelcontextprotocol.io/docs/tools/inspector", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[2]/p/span[2]/span[2]/span"}, {"position_id": 3235, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[14]/li[2]/p/span[3]/span/span"}]}, "tags": ["li"], "label": "content", "web_segment_id": 161, "global_sentence_id": 304, "edu_l1_label": "IOS"}, {"txt": "总结", "language": "chinese", "position": {"atoms": [{"position_id": 3237, "txt": "总结", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[17]/section/section/p/span"}]}, "tags": [], "label": "title1", "web_segment_id": 162, "global_sentence_id": 305, "edu_l1_label": "BOS"}, {"txt": "MCP (Model Context Protocol) 代表了 AI 与外部工具和数据交互的标准建立。", "language": "chinese", "position": {"atoms": [{"position_id": 3239, "txt": "MCP (Model Context Protocol) 代表了 AI 与外部工具和数据交互的标准建立。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[49]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 163, "global_sentence_id": 306, "edu_l1_label": "IOS"}, {"txt": "通过本文，我们可以了解到：", "language": "chinese", "position": {"atoms": [{"position_id": 3240, "txt": "通过本文，我们可以了解到：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[49]/span/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 163, "global_sentence_id": 307, "edu_l1_label": "IOS"}, {"txt": "MCP 的本质：", "language": "chinese", "position": {"atoms": [{"position_id": 3242, "txt": "MCP 的本质", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[15]/li[1]/p/span[1]/span/span"}, {"position_id": 3244, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[15]/li[1]/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 164, "global_sentence_id": 308, "edu_l1_label": "IOS"}, {"txt": "它是一个统一的协议标准，使 AI 模型能够以一致的方式连接各种数据源和工具，类似于 AI 世界的\"USB-C\"接口。", "language": "chinese", "position": {"atoms": [{"position_id": 3246, "txt": "它是一个统一的协议标准，使 AI 模型能够以一致的方式连接各种数据源和工具，类似于 AI 世界的\"USB-C\"接口。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[15]/li[1]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 164, "global_sentence_id": 309, "edu_l1_label": "IOS"}, {"txt": "MCP 的价值：", "language": "chinese", "position": {"atoms": [{"position_id": 3248, "txt": "MCP 的价值", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[15]/li[2]/p/span[1]/span/span"}, {"position_id": 3250, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[15]/li[2]/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 165, "global_sentence_id": 310, "edu_l1_label": "IOS"}, {"txt": "它解决了传统 function call 的平台依赖问题，提供了更统一、开放、安全、灵活的工具调用机制，让用户和开发者都能从中受益。", "language": "chinese", "position": {"atoms": [{"position_id": 3252, "txt": "它解决了传统 function call 的平台依赖问题，提供了更统一、开放、安全、灵活的工具调用机制，让用户和开发者都能从中受益。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[15]/li[2]/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 165, "global_sentence_id": 311, "edu_l1_label": "IOS"}, {"txt": "使用与开发：", "language": "chinese", "position": {"atoms": [{"position_id": 3254, "txt": "使用与开发", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[16]/li/p/span[1]/span/span"}, {"position_id": 3256, "txt": "：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[16]/li/p/span[2]/span/span[1]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 166, "global_sentence_id": 312, "edu_l1_label": "IOS"}, {"txt": "对于普通用户，MCP 提供了丰富的现成工具，用户可以在不了解任何技术细节的情况下使用；", "language": "chinese", "position": {"atoms": [{"position_id": 3258, "txt": "对于普通用户，MCP 提供了丰富的现成工具，用户可以在不了解任何技术细节的情况下使用；", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[16]/li/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 166, "global_sentence_id": 313, "edu_l1_label": "IOS"}, {"txt": "对于开发者，MCP 提供了清晰的架构和 SDK，使工具开发变得相对简单。", "language": "chinese", "position": {"atoms": [{"position_id": 3259, "txt": "对于开发者，MCP 提供了清晰的架构和 SDK，使工具开发变得相对简单。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/ul[16]/li/p/span[2]/span/span[2]"}]}, "tags": ["li"], "label": "content", "web_segment_id": 166, "global_sentence_id": 314, "edu_l1_label": "IOS"}, {"txt": "MCP 还处于发展初期，但其潜力巨大。", "language": "chinese", "position": {"atoms": [{"position_id": 3261, "txt": "MCP 还处于发展初期，但其潜力巨大。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[50]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 167, "global_sentence_id": 315, "edu_l1_label": "IOS"}, {"txt": "更重要的是生态，基于统一标准下构筑的生态也会正向的促进整个领域的发展。", "language": "chinese", "position": {"atoms": [{"position_id": 3262, "txt": "更重要的是生态，基于统一标准下构筑的生态也会正向的促进整个领域的发展。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[50]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 167, "global_sentence_id": 316, "edu_l1_label": "IOS"}, {"txt": "我们可以看看MCP工具平台：", "language": "chinese", "position": {"atoms": [{"position_id": 3263, "txt": "我们可以看看MCP工具平台：", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[50]/span[1]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 167, "global_sentence_id": 317, "edu_l1_label": "IOS"}, {"txt": "https://mcp.so/﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3265, "txt": "https://mcp.so/", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[50]/span[2]/span/span"}, {"position_id": 3267, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[50]/span[3]/span/span"}]}, "tags": [], "label": "content", "web_segment_id": 167, "global_sentence_id": 318, "edu_l1_label": "IOS"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3269, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[51]/span[1]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 168, "global_sentence_id": 319, "edu_l1_label": "EDU_O"}, {"txt": "<img https://mmbiz.qpic.cn/mmbiz_jpg/Z6bicxIx5naI1MWDBvOvKpP7WAY0ebsGad6BY2S2sdBofSibWvlm6z9SgVz9xj38OqpN9AcqRURoDgPFibWO8iaVBw/640?wx_fmt=other&from=appmsg", "language": "chinese", "position": {"atoms": [{"position_id": 1755, "txt": "<img https://mmbiz.qpic.cn/mmbiz_jpg/Z6bicxIx5naI1MWDBvOvKpP7WAY0ebsGad6BY2S2sdBofSibWvlm6z9SgVz9xj38OqpN9AcqRURoDgPFibWO8iaVBw/640?wx_fmt=other&from=appmsg", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[51]/span[2]/span[1]/span/img"}]}, "tags": ["img"], "label": "O", "web_segment_id": 168, "global_sentence_id": 320, "edu_l1_label": "EDU_O"}, {"txt": "﻿", "language": "chinese", "position": {"atoms": [{"position_id": 3271, "txt": "﻿", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/p[51]/span[3]/span/span"}]}, "tags": [], "label": "O", "web_segment_id": 168, "global_sentence_id": 321, "edu_l1_label": "EDU_O"}, {"txt": "通义千问和LangChain搭建对话服务", "language": "chinese", "position": {"atoms": [{"position_id": 3273, "txt": "通义千问和LangChain搭建对话服务", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[18]/section/section/section[1]/section[2]/section/p[2]/strong/span/span"}]}, "tags": ["strong"], "label": "O", "web_segment_id": 169, "global_sentence_id": 322, "edu_l1_label": "EDU_O"}, {"txt": "结合通义千问和LangChain技术构建高效的对话模型，该模型基于自然语言处理技术提升语义理解和用户交互体验。", "language": "chinese", "position": {"atoms": [{"position_id": 3275, "txt": "结合通义千问和LangChain技术构建高效的对话模型，该模型基于自然语言处理技术提升语义理解和用户交互体验。", "x": "/html/body/div[2]/div[2]/div[2]/div/div[1]/div[2]/section[18]/section/section/section[3]/p[1]/span"}]}, "tags": [], "label": "O", "web_segment_id": 170, "global_sentence_id": 323, "edu_l1_label": "EDU_O"}, {"txt": "                        阿里云开发者                      ", "language": "chinese", "position": {"atoms": [{"position_id": 3277, "txt": "\n                        阿里云开发者                      ", "x": "/html/body/div[4]/div[2]/div[2]/div[1]/div[1]/div/div/div/div/div[2]/div/div"}]}, "tags": [], "label": "O", "web_segment_id": 188, "global_sentence_id": 324, "edu_l1_label": "EDU_O"}], "type": "WEB"}
# 一文讲透MCP的原理及实践
## MCP是什么
## MCP 架构
## 为什么需要 MCP 呢？
## MCP原理
### VS Function Call
### 模型如何智能选择Agent/工具
### 工具执行与结果反馈机制
## MCP Server 开发实践
### 1、使用 LLM 构建 MCP 的最佳实践
#### 1.引入 domain knowledge （说人话就是，告诉他一些 MCP Server 开发的范例和资料）
#### 2.描述你的需求
### 2、手动实践
#### Step1. 前置工作
#### Step2. 环境配置
#### Step3. 构造一个 prompt
#### Step4. 实现 MCP Server
#### Step5. 测试 MCP Server
#### Step6. 接入 Claude
#### Step7. 实际使用
### 3、MCP Server Debug
## 总结
