Skip to content

Mcp vs api calls (Updates) - #832

Closed
leriomaggio wants to merge 7 commits into
masterfrom
mcp-vs-api-calls
Closed

leriomaggio wants to merge 7 commits into
masterfrom
mcp-vs-api-calls

Conversation

@leriomaggio

Copy link
Copy Markdown
Contributor

Updated materials based on latest changes to the code after revision.

leriomaggio and others added 7 commits September 2, 2026 13:48
This function retrieves package information from PyPI, including the name, version, and summary.
Materials attached to the "MCP vs API Calls: Which Should You Use for Python LLM Apps?" tutorial
Add README for MCP vs API Calls tutorial with setup instructions and example usage.
Increased max_tokens from 1024 to 2048 and refactored tool_result function to simplify the return structure. Updated main function to handle tool results more efficiently.
realpython-bot pushed a commit that referenced this pull request Sep 16, 2026
Consolidates the two open PRs on this folder into one.

- Renames mcp-vs-api-calls/ to mcp-vs-api/ to match the tutorial slug
  (supersedes #819, minus its stray root-level uv.lock).
- Syncs client.py and client_api.py with the tech-review changes in
  tutorial-drafts#1184: collect every tool_use block and append the
  assistant turn once, select the text block by type rather than
  position, and raise max_tokens to 2048 (supersedes #832).
- Repairs the leftover fragments in #832: client_api.py did not parse,
  and client.py ran its __main__ block twice.
- Points the README at the correct tutorial URL and the pinned install
  command.

Code verified line-for-line against the article. ruff check and
ruff format pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@realpython-bot

Copy link
Copy Markdown
Collaborator

Superseded by #850, which carries these changes through to master.

Thanks @leriomaggio — the code changes here are yours and they're correct: collecting every tool_use block, appending the assistant turn once, and selecting the text block by type rather than position. #850 keeps all of it.

Two things meant this branch couldn't merge as-is, both of which look like leftovers from the edit rather than anything you intended:

  • client_api.py doesn't parse. A fragment of the old main() was left below if __name__ == "__main__": at line 79, giving SyntaxError: unexpected indent.
  • client.py has a duplicated if __name__ == "__main__": block (lines 74-79 and 82-87), so it would launch the server and run the whole conversation twice.

The branch also reused the mcp-vs-api-calls name from the already-merged #816, so GitHub saw all five files as newly added and marked it conflicting against master.

#850 rebases onto current master, repairs both leftovers, and folds in the folder rename from #819 so there's a single PR to merge.


🤖 Posted by Claude Code (RPBot) on Stephen's behalf, with his permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants