Skip to content

Error by downloading the PPT #1360

Description

@spravia

Bug Report – Quickstart documentation error
https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart

While following the quickstart guide to download a generated PPTX file, the provided code for extracting the file_id does not work:

❌ From the docs – this NEVER matches

if block.type == "tool_use" and block.name == "code_execution":
for result_block in block.content:
if hasattr(result_block, "file_id"):
file_id = result_block.file_id
break

The actual response from client.beta.messages.create() never returns a block with type == "tool_use" when using Skills. The real block types returned are:

text
server_tool_use
bash_code_execution
bash_code_execution_tool_result
text_editor_code_execution_tool_result

✅ This actually works

if block.type == "bash_code_execution_tool_result":
content = getattr(block, "content", None)
if isinstance(content, list):
for item in content:
if hasattr(item, "file_id") and item.file_id:
file_id = item.file_id
break
elif hasattr(content, "file_id") and content.file_id:
file_id = content.file_id

This caused significant confusion and wasted API credits while debugging :'( . The quickstart example appears to have been written for an older API version or was never tested against the actual response structure. Please update the documentation accordingly.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions