面试题库
共 328 题,当前筛选 1 题。
课程全部30 天从前端工程师到 Agent 工程师5 天提示词工程零基础Claude 高效使用:从对话到 Claude CodeCodex 与 OpenAI Agents SDK 高效使用7 天 MCP:把工具接进任何 Agent7 天 Agent Skills:把经验做成可复用能力5 天上下文工程14 天 RAG:从检索到可信回答14 天用 Agent 搭一条 AI 短剧生产线
7 天 MCP:把工具接进任何 Agent
D3 resources 与 prompts:URI 模板、变更通知、进度与日志、分页,以及客户端能力
同一份数据,做成 MCP 资源和做成工具有什么区别?你按什么标准选?For the same data, what is the difference between exposing it as an MCP resource versus a tool, and how do you choose?
国内高频海外高频基础#primitives#server-design分析过程 · 先想清楚再作答
- 这题在筛「有没有真的设计过服务端」。答成「资源是只读的、工具会改数据」只能算及格,因为只读的检索照样该做成工具,区分度全在这一步。
- 拆法:不要问「它是什么」,问「这一次由谁决定用不用它」。规范把资源定成应用驱动——由宿主应用或用户挑;工具是模型控制——模型看着描述自己调。控制方定了,出错时该找谁负责也就定了。
- 再补一条更实用的判据:能不能被枚举。资源要出现在一张可翻页的清单里让人挑,所以「搜索代码」这种输入空间无限的能力,哪怕完全只读也必须做成工具。
- 结论:只读、可枚举、希望用户在界面上挑的做成资源;有副作用、或需要模型自己判断时机、或无法枚举的做成工具。
- 生产视角要主动加一句成本:工具定义不管用不用,每轮都要塞进请求;资源不被选中就一个 token 都不占。三千篇文档做成三千个工具会直接撑爆上下文,做成资源则按需付费。
- 可预期的追问:那提示模板算第几种?答案是第三种,由用户显式选中,典型形态是斜杠命令——三种原语的差别只在控制方,不在能力。
How to reason about it · think before answering
- This screens for real server design experience. Saying resources are read-only and tools mutate scores a pass at best, because read-only search still belongs in a tool.
- Reframe it: do not ask what the data is, ask who decides to use it this time. The spec makes resources application-driven, picked by the host or the user, while tools are model-controlled. Fixing the controller also fixes who is accountable when it goes wrong.
- Add the practical test: enumerability. A resource has to appear in a paginated list a human can pick from, so a code search with an unbounded input space must be a tool even though it never writes anything.
- Conclusion: read-only, enumerable, user-selectable becomes a resource; side-effecting, model-timed, or non-enumerable becomes a tool.
- Bring up cost unprompted: tool definitions ship on every turn whether used or not, while an unselected resource costs zero tokens. Three thousand documents as three thousand tools blows up the context window; as resources they are pay-per-use.
- Likely follow-up: where do prompts fit? They are the third primitive, user-selected and usually surfaced as slash commands — the three differ only by who controls them.
答题要点
- 资源是应用驱动的,由宿主或用户挑;工具是模型控制的,由模型看描述自己调
- 能不能枚举是最实用的分界线:搜索这类输入空间无限的能力即使只读也做成工具
- 成本上工具定义每轮都占上下文,资源不被选中就不花钱,大规模知识库必须走资源
- 控制方决定了出错时找谁负责:模型选错是描述问题,用户选错是命名问题,应用塞错是产品问题
Key points
- Resources are application-driven and picked by host or user; tools are model-controlled and chosen from their descriptions
- Enumerability is the practical dividing line: unbounded-input capabilities like search stay tools even when read-only
- Cost-wise tool definitions occupy context every turn while unselected resources cost nothing, so large corpora must be resources
- The controller determines accountability: bad tool choice means bad descriptions, bad prompt choice means bad naming, bad resource injection is a product problem