feat(tool_use): Add cookbook for FastMCP primitives with Claude#510
feat(tool_use): Add cookbook for FastMCP primitives with Claude#510cubaseuser123 wants to merge 1 commit intoanthropics:mainfrom
Conversation
59c7a9d to
ca0dd33
Compare
|
Missing registry.yaml and authors.yaml entries — every cookbook needs these to show up in the registry. See other recent PRs for the format. |
|
Thanks for pointing that out! I completely missed the registry requirements. I've just added the correct entries to both |
martingarramon
left a comment
There was a problem hiding this comment.
Good companion to the native MCP client notebook. The three-primitive structure (tool/resource/prompt) is the right framing for FastMCP. A few observations:
Scope: The PR adds two notebooks — the FastMCP one (described in the PR) and a native MCP client notebook at tool_use/mcp_native_client/claude_with_mcp.ipynb that isn't mentioned in the description. Is the second notebook from your earlier PR #499, or is it new? Worth calling out in the description either way so reviewers know what they're evaluating.
FastMCP API usage: The @mcp.resource(), @mcp.tool(), and Context injection all look correct. One thing to verify: @mcp.prompt(title="Topic Expert") — in the FastMCP API I've seen, the decorator typically takes name and description rather than title. If title isn't a real parameter, it would silently be ignored. Worth confirming against the current mcp SDK version.
Mock outputs note: The PR description says mock execution outputs were injected directly into the notebook JSON. The cookbook repo keeps outputs intentionally (CONTRIBUTING.md rule), so they'll be treated as real by readers. If any mock output diverges from what the code actually produces, it'll confuse anyone trying to reproduce. Might be worth a note in the notebook that outputs are illustrative, or — better — running the notebook and capturing real outputs.
Model and API key: claude-haiku-4-5 (correct alias) and os.environ.get("ANTHROPIC_API_KEY") — both good.
- FastMCP server with tools, resources, and prompts - Fix @mcp.prompt decorator to use name/description params - Add illustrative output note for mock cell outputs - Add authors.yaml and registry.yaml entries
32fbc8c to
616024c
Compare
|
Thanks for the thorough review! I've addressed all three points in a single force-pushed commit: 1. Scope: I rebased the branch so it now only contains the FastMCP notebook and its YAML metadata. The native MCP client notebook at 2. 3. Mock outputs: I added a visible note in the introductory cell clarifying that the execution outputs shown are illustrative. I don't currently have active API access to capture live outputs for this new run, but the code is structured cleanly so anyone with a key can run it directly anyway. |
|
Orb Code Review (powered by GLM 5.1 on Orb Cloud) New cookbook: FastMCP with Claude, covering all three MCP primitives (tools, resources, prompts) and Context for logging/progress. Observations1. Good coverage of all MCP primitives (Positive) 2. 3. Mock outputs committed (Note) 4. Author avatar URL (Low) avatar: https://github.com/cubaseuser123.pngThis uses the generic GitHub profile picture URL. Other entries in SummarySolid cookbook that effectively demonstrates FastMCP's primitives. The clear explanations and working code examples make it a good reference for MCP development. Assessment: approve |
Following up on the basic native MCP client cookbook, I put together a companion notebook to specifically document the high-level
FastMCPframework.While building basic MCP tools is straightforward, there's currently a bit of a documentation gap when it comes to tying together FastMCP's advanced primitives with a Claude client in Python. This notebook builds a simple "knowledge server" to demo exactly how to do that.
It covers:
@mcp.resource@mcp.promptContextinjection to do programmatic server-side logging (ctx.info()) mid-tool execution without polluting the LLM's tool loop.I made sure it runs cleanly against the local
ruffconfiguration (E, F, and W flags) and properly formats tonbformat 4. I also injected realistic mock execution outputs directly into the notebook JSON, so it should render perfectly in the GitHub preview UI right away.Let me know if you want me to tweak any of the examples!