claudecode-omc 5.2.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/manifest.json +2 -1
- package/bundled/upstream/anthropic-skills/skills/algorithmic-art/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/algorithmic-art/SKILL.md +405 -0
- package/bundled/upstream/anthropic-skills/skills/algorithmic-art/templates/generator_template.js +223 -0
- package/bundled/upstream/anthropic-skills/skills/algorithmic-art/templates/viewer.html +599 -0
- package/bundled/upstream/anthropic-skills/skills/brand-guidelines/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/brand-guidelines/SKILL.md +73 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/SKILL.md +130 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/bundled/upstream/anthropic-skills/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/SKILL.md +262 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/csharp/claude-api.md +402 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/curl/examples.md +216 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/go/claude-api.md +421 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/java/claude-api.md +432 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/php/claude-api.md +375 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/agent-sdk/README.md +355 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/agent-sdk/patterns.md +359 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/README.md +420 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/batches.md +185 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/files-api.md +165 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/streaming.md +162 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/tool-use.md +590 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/ruby/claude-api.md +113 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/error-codes.md +206 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/live-sources.md +121 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/models.md +119 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/prompt-caching.md +128 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/tool-use-concepts.md +305 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/agent-sdk/README.md +297 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/agent-sdk/patterns.md +209 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/README.md +333 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/batches.md +106 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/files-api.md +98 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/streaming.md +178 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/tool-use.md +527 -0
- package/bundled/upstream/anthropic-skills/skills/doc-coauthoring/SKILL.md +375 -0
- package/bundled/upstream/anthropic-skills/skills/docx/LICENSE.txt +30 -0
- package/bundled/upstream/anthropic-skills/skills/docx/SKILL.md +590 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/__init__.py +1 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/accept_changes.py +135 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/comment.py +318 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/helpers/__init__.py +0 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/helpers/merge_runs.py +199 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/pack.py +159 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/soffice.py +183 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/unpack.py +132 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/validate.py +111 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/validators/__init__.py +15 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/validators/base.py +847 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/validators/docx.py +446 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/validators/pptx.py +275 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/office/validators/redlining.py +247 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/templates/comments.xml +3 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/bundled/upstream/anthropic-skills/skills/docx/scripts/templates/people.xml +3 -0
- package/bundled/upstream/anthropic-skills/skills/frontend-design/LICENSE.txt +177 -0
- package/bundled/upstream/anthropic-skills/skills/frontend-design/SKILL.md +42 -0
- package/bundled/upstream/anthropic-skills/skills/internal-comms/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/internal-comms/SKILL.md +32 -0
- package/bundled/upstream/anthropic-skills/skills/internal-comms/examples/3p-updates.md +47 -0
- package/bundled/upstream/anthropic-skills/skills/internal-comms/examples/company-newsletter.md +65 -0
- package/bundled/upstream/anthropic-skills/skills/internal-comms/examples/faq-answers.md +30 -0
- package/bundled/upstream/anthropic-skills/skills/internal-comms/examples/general-comms.md +16 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/SKILL.md +236 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/reference/evaluation.md +602 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/scripts/connections.py +151 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/bundled/upstream/anthropic-skills/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/LICENSE.txt +30 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/SKILL.md +314 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/forms.md +294 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/reference.md +612 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/scripts/check_bounding_boxes.py +65 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/scripts/check_fillable_fields.py +11 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/scripts/create_validation_image.py +37 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/scripts/extract_form_field_info.py +122 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/scripts/extract_form_structure.py +115 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/scripts/fill_fillable_fields.py +98 -0
- package/bundled/upstream/anthropic-skills/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/LICENSE.txt +30 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/SKILL.md +232 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/editing.md +205 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/pptxgenjs.md +420 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/__init__.py +0 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/add_slide.py +195 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/clean.py +286 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/helpers/__init__.py +0 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/helpers/merge_runs.py +199 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/pack.py +159 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/soffice.py +183 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/unpack.py +132 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/validate.py +111 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/validators/__init__.py +15 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/validators/base.py +847 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/validators/docx.py +446 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/validators/pptx.py +275 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/office/validators/redlining.py +247 -0
- package/bundled/upstream/anthropic-skills/skills/pptx/scripts/thumbnail.py +289 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/SKILL.md +485 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/agents/analyzer.md +274 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/agents/comparator.md +202 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/agents/grader.md +223 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/assets/eval_review.html +146 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/references/schemas.md +430 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/__init__.py +0 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/generate_report.py +326 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/improve_description.py +247 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/package_skill.py +136 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/run_eval.py +310 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/run_loop.py +328 -0
- package/bundled/upstream/anthropic-skills/skills/skill-creator/scripts/utils.py +47 -0
- package/bundled/upstream/anthropic-skills/skills/slack-gif-creator/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/slack-gif-creator/SKILL.md +254 -0
- package/bundled/upstream/anthropic-skills/skills/slack-gif-creator/core/easing.py +234 -0
- package/bundled/upstream/anthropic-skills/skills/slack-gif-creator/core/frame_composer.py +176 -0
- package/bundled/upstream/anthropic-skills/skills/slack-gif-creator/core/gif_builder.py +269 -0
- package/bundled/upstream/anthropic-skills/skills/slack-gif-creator/core/validators.py +136 -0
- package/bundled/upstream/anthropic-skills/skills/slack-gif-creator/requirements.txt +4 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/SKILL.md +59 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/theme-showcase.pdf +0 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/arctic-frost.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/botanical-garden.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/desert-rose.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/forest-canopy.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/golden-hour.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/midnight-galaxy.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/modern-minimalist.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/ocean-depths.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/sunset-boulevard.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/theme-factory/themes/tech-innovation.md +19 -0
- package/bundled/upstream/anthropic-skills/skills/web-artifacts-builder/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/web-artifacts-builder/SKILL.md +74 -0
- package/bundled/upstream/anthropic-skills/skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/bundled/upstream/anthropic-skills/skills/web-artifacts-builder/scripts/init-artifact.sh +322 -0
- package/bundled/upstream/anthropic-skills/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/bundled/upstream/anthropic-skills/skills/webapp-testing/LICENSE.txt +202 -0
- package/bundled/upstream/anthropic-skills/skills/webapp-testing/SKILL.md +96 -0
- package/bundled/upstream/anthropic-skills/skills/webapp-testing/examples/console_logging.py +35 -0
- package/bundled/upstream/anthropic-skills/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/bundled/upstream/anthropic-skills/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/bundled/upstream/anthropic-skills/skills/webapp-testing/scripts/with_server.py +106 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/LICENSE.txt +30 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/SKILL.md +292 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/helpers/__init__.py +0 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/helpers/merge_runs.py +199 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/pack.py +159 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/soffice.py +183 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/unpack.py +132 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/validate.py +111 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/validators/__init__.py +15 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/validators/base.py +847 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/validators/docx.py +446 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/validators/pptx.py +275 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/office/validators/redlining.py +247 -0
- package/bundled/upstream/anthropic-skills/skills/xlsx/scripts/recalc.py +184 -0
- package/bundled/upstream/anthropic-skills/spec/agent-skills-spec.md +3 -0
- package/bundled/upstream/anthropic-skills/template/SKILL.md +6 -0
- package/package.json +1 -1
- package/src/cli/artifact.js +18 -3
- package/src/cli/index.js +6 -0
- package/src/cli/setup.js +16 -1
- package/src/cli/skill.js +271 -0
- package/src/config/sources.js +12 -0
- package/src/merge/base-merger.js +28 -6
- package/src/utils/overlap.js +300 -0
- package/src/utils/quality.js +286 -32
- package/templates/merge-config.json +12 -1
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
# Tool Use — Python
|
|
2
|
+
|
|
3
|
+
For conceptual overview (tool definitions, tool choice, tips), see [shared/tool-use-concepts.md](../../shared/tool-use-concepts.md).
|
|
4
|
+
|
|
5
|
+
## Tool Runner (Recommended)
|
|
6
|
+
|
|
7
|
+
**Beta:** The tool runner is in beta in the Python SDK.
|
|
8
|
+
|
|
9
|
+
Use the `@beta_tool` decorator to define tools as typed functions, then pass them to `client.beta.messages.tool_runner()`:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
import anthropic
|
|
13
|
+
from anthropic import beta_tool
|
|
14
|
+
|
|
15
|
+
client = anthropic.Anthropic()
|
|
16
|
+
|
|
17
|
+
@beta_tool
|
|
18
|
+
def get_weather(location: str, unit: str = "celsius") -> str:
|
|
19
|
+
"""Get current weather for a location.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
location: City and state, e.g., San Francisco, CA.
|
|
23
|
+
unit: Temperature unit, either "celsius" or "fahrenheit".
|
|
24
|
+
"""
|
|
25
|
+
# Your implementation here
|
|
26
|
+
return f"72°F and sunny in {location}"
|
|
27
|
+
|
|
28
|
+
# The tool runner handles the agentic loop automatically
|
|
29
|
+
runner = client.beta.messages.tool_runner(
|
|
30
|
+
model="claude-opus-4-6",
|
|
31
|
+
max_tokens=16000,
|
|
32
|
+
tools=[get_weather],
|
|
33
|
+
messages=[{"role": "user", "content": "What's the weather in Paris?"}],
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Each iteration yields a BetaMessage; iteration stops when Claude is done
|
|
37
|
+
for message in runner:
|
|
38
|
+
print(message)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For async usage, use `@beta_async_tool` with `async def` functions.
|
|
42
|
+
|
|
43
|
+
**Key benefits of the tool runner:**
|
|
44
|
+
|
|
45
|
+
- No manual loop — the SDK handles calling tools and feeding results back
|
|
46
|
+
- Type-safe tool inputs via decorators
|
|
47
|
+
- Tool schemas are generated automatically from function signatures
|
|
48
|
+
- Iteration stops automatically when Claude has no more tool calls
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## MCP Tool Conversion Helpers
|
|
53
|
+
|
|
54
|
+
**Beta.** Convert [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) tools, prompts, and resources to Anthropic API types for use with the tool runner. Requires `pip install anthropic[mcp]` (Python 3.10+).
|
|
55
|
+
|
|
56
|
+
> **Note:** The Claude API also supports an `mcp_servers` parameter that lets Claude connect directly to remote MCP servers. Use these helpers instead when you need local MCP servers, prompts, resources, or more control over the MCP connection.
|
|
57
|
+
|
|
58
|
+
### MCP Tools with Tool Runner
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from anthropic import AsyncAnthropic
|
|
62
|
+
from anthropic.lib.tools.mcp import async_mcp_tool
|
|
63
|
+
from mcp import ClientSession
|
|
64
|
+
from mcp.client.stdio import stdio_client, StdioServerParameters
|
|
65
|
+
|
|
66
|
+
client = AsyncAnthropic()
|
|
67
|
+
|
|
68
|
+
async with stdio_client(StdioServerParameters(command="mcp-server")) as (read, write):
|
|
69
|
+
async with ClientSession(read, write) as mcp_client:
|
|
70
|
+
await mcp_client.initialize()
|
|
71
|
+
|
|
72
|
+
tools_result = await mcp_client.list_tools()
|
|
73
|
+
# tool_runner is sync — returns the runner, not a coroutine
|
|
74
|
+
runner = client.beta.messages.tool_runner(
|
|
75
|
+
model="claude-opus-4-6",
|
|
76
|
+
max_tokens=16000,
|
|
77
|
+
messages=[{"role": "user", "content": "Use the available tools"}],
|
|
78
|
+
tools=[async_mcp_tool(t, mcp_client) for t in tools_result.tools],
|
|
79
|
+
)
|
|
80
|
+
async for message in runner:
|
|
81
|
+
print(message)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For sync usage, use `mcp_tool` instead of `async_mcp_tool`.
|
|
85
|
+
|
|
86
|
+
### MCP Prompts
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from anthropic.lib.tools.mcp import mcp_message
|
|
90
|
+
|
|
91
|
+
prompt = await mcp_client.get_prompt(name="my-prompt")
|
|
92
|
+
response = await client.beta.messages.create(
|
|
93
|
+
model="claude-opus-4-6",
|
|
94
|
+
max_tokens=16000,
|
|
95
|
+
messages=[mcp_message(m) for m in prompt.messages],
|
|
96
|
+
)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### MCP Resources as Content
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from anthropic.lib.tools.mcp import mcp_resource_to_content
|
|
103
|
+
|
|
104
|
+
resource = await mcp_client.read_resource(uri="file:///path/to/doc.txt")
|
|
105
|
+
response = await client.beta.messages.create(
|
|
106
|
+
model="claude-opus-4-6",
|
|
107
|
+
max_tokens=16000,
|
|
108
|
+
messages=[{
|
|
109
|
+
"role": "user",
|
|
110
|
+
"content": [
|
|
111
|
+
mcp_resource_to_content(resource),
|
|
112
|
+
{"type": "text", "text": "Summarize this document"},
|
|
113
|
+
],
|
|
114
|
+
}],
|
|
115
|
+
)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Upload MCP Resources as Files
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from anthropic.lib.tools.mcp import mcp_resource_to_file
|
|
122
|
+
|
|
123
|
+
resource = await mcp_client.read_resource(uri="file:///path/to/data.json")
|
|
124
|
+
uploaded = await client.beta.files.upload(file=mcp_resource_to_file(resource))
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Conversion functions raise `UnsupportedMCPValueError` if an MCP value cannot be converted (e.g., unsupported content types like audio, unsupported MIME types).
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Manual Agentic Loop
|
|
132
|
+
|
|
133
|
+
Use this when you need fine-grained control over the loop (e.g., custom logging, conditional tool execution, human-in-the-loop approval):
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import anthropic
|
|
137
|
+
|
|
138
|
+
client = anthropic.Anthropic()
|
|
139
|
+
tools = [...] # Your tool definitions
|
|
140
|
+
messages = [{"role": "user", "content": user_input}]
|
|
141
|
+
|
|
142
|
+
# Agentic loop: keep going until Claude stops calling tools
|
|
143
|
+
while True:
|
|
144
|
+
response = client.messages.create(
|
|
145
|
+
model="claude-opus-4-6",
|
|
146
|
+
max_tokens=16000,
|
|
147
|
+
tools=tools,
|
|
148
|
+
messages=messages
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# If Claude is done (no more tool calls), break
|
|
152
|
+
if response.stop_reason == "end_turn":
|
|
153
|
+
break
|
|
154
|
+
|
|
155
|
+
# Server-side tool hit iteration limit; re-send to continue
|
|
156
|
+
if response.stop_reason == "pause_turn":
|
|
157
|
+
messages = [
|
|
158
|
+
{"role": "user", "content": user_input},
|
|
159
|
+
{"role": "assistant", "content": response.content},
|
|
160
|
+
]
|
|
161
|
+
continue
|
|
162
|
+
|
|
163
|
+
# Extract tool use blocks from the response
|
|
164
|
+
tool_use_blocks = [b for b in response.content if b.type == "tool_use"]
|
|
165
|
+
|
|
166
|
+
# Append assistant's response (including tool_use blocks)
|
|
167
|
+
messages.append({"role": "assistant", "content": response.content})
|
|
168
|
+
|
|
169
|
+
# Execute each tool and collect results
|
|
170
|
+
tool_results = []
|
|
171
|
+
for tool in tool_use_blocks:
|
|
172
|
+
result = execute_tool(tool.name, tool.input) # Your implementation
|
|
173
|
+
tool_results.append({
|
|
174
|
+
"type": "tool_result",
|
|
175
|
+
"tool_use_id": tool.id, # Must match the tool_use block's id
|
|
176
|
+
"content": result
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
# Append tool results as a user message
|
|
180
|
+
messages.append({"role": "user", "content": tool_results})
|
|
181
|
+
|
|
182
|
+
# Final response text
|
|
183
|
+
final_text = next(b.text for b in response.content if b.type == "text")
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Handling Tool Results
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
response = client.messages.create(
|
|
192
|
+
model="claude-opus-4-6",
|
|
193
|
+
max_tokens=16000,
|
|
194
|
+
tools=tools,
|
|
195
|
+
messages=[{"role": "user", "content": "What's the weather in Paris?"}]
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
for block in response.content:
|
|
199
|
+
if block.type == "tool_use":
|
|
200
|
+
tool_name = block.name
|
|
201
|
+
tool_input = block.input
|
|
202
|
+
tool_use_id = block.id
|
|
203
|
+
|
|
204
|
+
result = execute_tool(tool_name, tool_input)
|
|
205
|
+
|
|
206
|
+
followup = client.messages.create(
|
|
207
|
+
model="claude-opus-4-6",
|
|
208
|
+
max_tokens=16000,
|
|
209
|
+
tools=tools,
|
|
210
|
+
messages=[
|
|
211
|
+
{"role": "user", "content": "What's the weather in Paris?"},
|
|
212
|
+
{"role": "assistant", "content": response.content},
|
|
213
|
+
{
|
|
214
|
+
"role": "user",
|
|
215
|
+
"content": [{
|
|
216
|
+
"type": "tool_result",
|
|
217
|
+
"tool_use_id": tool_use_id,
|
|
218
|
+
"content": result
|
|
219
|
+
}]
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Multiple Tool Calls
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
tool_results = []
|
|
231
|
+
|
|
232
|
+
for block in response.content:
|
|
233
|
+
if block.type == "tool_use":
|
|
234
|
+
result = execute_tool(block.name, block.input)
|
|
235
|
+
tool_results.append({
|
|
236
|
+
"type": "tool_result",
|
|
237
|
+
"tool_use_id": block.id,
|
|
238
|
+
"content": result
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
# Send all results back at once
|
|
242
|
+
if tool_results:
|
|
243
|
+
followup = client.messages.create(
|
|
244
|
+
model="claude-opus-4-6",
|
|
245
|
+
max_tokens=16000,
|
|
246
|
+
tools=tools,
|
|
247
|
+
messages=[
|
|
248
|
+
*previous_messages,
|
|
249
|
+
{"role": "assistant", "content": response.content},
|
|
250
|
+
{"role": "user", "content": tool_results}
|
|
251
|
+
]
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Error Handling in Tool Results
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
tool_result = {
|
|
261
|
+
"type": "tool_result",
|
|
262
|
+
"tool_use_id": tool_use_id,
|
|
263
|
+
"content": "Error: Location 'xyz' not found. Please provide a valid city name.",
|
|
264
|
+
"is_error": True
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Tool Choice
|
|
271
|
+
|
|
272
|
+
```python
|
|
273
|
+
response = client.messages.create(
|
|
274
|
+
model="claude-opus-4-6",
|
|
275
|
+
max_tokens=16000,
|
|
276
|
+
tools=tools,
|
|
277
|
+
tool_choice={"type": "tool", "name": "get_weather"}, # Force specific tool
|
|
278
|
+
messages=[{"role": "user", "content": "What's the weather in Paris?"}]
|
|
279
|
+
)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Code Execution
|
|
285
|
+
|
|
286
|
+
### Basic Usage
|
|
287
|
+
|
|
288
|
+
```python
|
|
289
|
+
import anthropic
|
|
290
|
+
|
|
291
|
+
client = anthropic.Anthropic()
|
|
292
|
+
|
|
293
|
+
response = client.messages.create(
|
|
294
|
+
model="claude-opus-4-6",
|
|
295
|
+
max_tokens=16000,
|
|
296
|
+
messages=[{
|
|
297
|
+
"role": "user",
|
|
298
|
+
"content": "Calculate the mean and standard deviation of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
|
|
299
|
+
}],
|
|
300
|
+
tools=[{
|
|
301
|
+
"type": "code_execution_20260120",
|
|
302
|
+
"name": "code_execution"
|
|
303
|
+
}]
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
for block in response.content:
|
|
307
|
+
if block.type == "text":
|
|
308
|
+
print(block.text)
|
|
309
|
+
elif block.type == "bash_code_execution_tool_result":
|
|
310
|
+
print(f"stdout: {block.content.stdout}")
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Upload Files for Analysis
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
# 1. Upload a file
|
|
317
|
+
uploaded = client.beta.files.upload(file=open("sales_data.csv", "rb"))
|
|
318
|
+
|
|
319
|
+
# 2. Pass to code execution via container_upload block
|
|
320
|
+
# Code execution is GA; Files API is still beta (pass via extra_headers)
|
|
321
|
+
response = client.messages.create(
|
|
322
|
+
model="claude-opus-4-6",
|
|
323
|
+
max_tokens=16000,
|
|
324
|
+
extra_headers={"anthropic-beta": "files-api-2025-04-14"},
|
|
325
|
+
messages=[{
|
|
326
|
+
"role": "user",
|
|
327
|
+
"content": [
|
|
328
|
+
{"type": "text", "text": "Analyze this sales data. Show trends and create a visualization."},
|
|
329
|
+
{"type": "container_upload", "file_id": uploaded.id}
|
|
330
|
+
]
|
|
331
|
+
}],
|
|
332
|
+
tools=[{"type": "code_execution_20260120", "name": "code_execution"}]
|
|
333
|
+
)
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Retrieve Generated Files
|
|
337
|
+
|
|
338
|
+
```python
|
|
339
|
+
import os
|
|
340
|
+
|
|
341
|
+
OUTPUT_DIR = "./claude_outputs"
|
|
342
|
+
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
|
343
|
+
|
|
344
|
+
for block in response.content:
|
|
345
|
+
if block.type == "bash_code_execution_tool_result":
|
|
346
|
+
result = block.content
|
|
347
|
+
if result.type == "bash_code_execution_result" and result.content:
|
|
348
|
+
for file_ref in result.content:
|
|
349
|
+
if file_ref.type == "bash_code_execution_output":
|
|
350
|
+
metadata = client.beta.files.retrieve_metadata(file_ref.file_id)
|
|
351
|
+
file_content = client.beta.files.download(file_ref.file_id)
|
|
352
|
+
# Use basename to prevent path traversal; validate result
|
|
353
|
+
safe_name = os.path.basename(metadata.filename)
|
|
354
|
+
if not safe_name or safe_name in (".", ".."):
|
|
355
|
+
print(f"Skipping invalid filename: {metadata.filename}")
|
|
356
|
+
continue
|
|
357
|
+
output_path = os.path.join(OUTPUT_DIR, safe_name)
|
|
358
|
+
file_content.write_to_file(output_path)
|
|
359
|
+
print(f"Saved: {output_path}")
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Container Reuse
|
|
363
|
+
|
|
364
|
+
```python
|
|
365
|
+
# First request: set up environment
|
|
366
|
+
response1 = client.messages.create(
|
|
367
|
+
model="claude-opus-4-6",
|
|
368
|
+
max_tokens=16000,
|
|
369
|
+
messages=[{"role": "user", "content": "Install tabulate and create data.json with sample data"}],
|
|
370
|
+
tools=[{"type": "code_execution_20260120", "name": "code_execution"}]
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
# Get container ID from response
|
|
374
|
+
container_id = response1.container.id
|
|
375
|
+
|
|
376
|
+
# Second request: reuse the same container
|
|
377
|
+
response2 = client.messages.create(
|
|
378
|
+
container=container_id,
|
|
379
|
+
model="claude-opus-4-6",
|
|
380
|
+
max_tokens=16000,
|
|
381
|
+
messages=[{"role": "user", "content": "Read data.json and display as a formatted table"}],
|
|
382
|
+
tools=[{"type": "code_execution_20260120", "name": "code_execution"}]
|
|
383
|
+
)
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Response Structure
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
for block in response.content:
|
|
390
|
+
if block.type == "text":
|
|
391
|
+
print(block.text) # Claude's explanation
|
|
392
|
+
elif block.type == "server_tool_use":
|
|
393
|
+
print(f"Running: {block.name} - {block.input}") # What Claude is doing
|
|
394
|
+
elif block.type == "bash_code_execution_tool_result":
|
|
395
|
+
result = block.content
|
|
396
|
+
if result.type == "bash_code_execution_result":
|
|
397
|
+
if result.return_code == 0:
|
|
398
|
+
print(f"Output: {result.stdout}")
|
|
399
|
+
else:
|
|
400
|
+
print(f"Error: {result.stderr}")
|
|
401
|
+
else:
|
|
402
|
+
print(f"Tool error: {result.error_code}")
|
|
403
|
+
elif block.type == "text_editor_code_execution_tool_result":
|
|
404
|
+
print(f"File operation: {block.content}")
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## Memory Tool
|
|
410
|
+
|
|
411
|
+
### Basic Usage
|
|
412
|
+
|
|
413
|
+
```python
|
|
414
|
+
import anthropic
|
|
415
|
+
|
|
416
|
+
client = anthropic.Anthropic()
|
|
417
|
+
|
|
418
|
+
response = client.messages.create(
|
|
419
|
+
model="claude-opus-4-6",
|
|
420
|
+
max_tokens=16000,
|
|
421
|
+
messages=[{"role": "user", "content": "Remember that my preferred language is Python."}],
|
|
422
|
+
tools=[{"type": "memory_20250818", "name": "memory"}],
|
|
423
|
+
)
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### SDK Memory Helper
|
|
427
|
+
|
|
428
|
+
Subclass `BetaAbstractMemoryTool`:
|
|
429
|
+
|
|
430
|
+
```python
|
|
431
|
+
from anthropic.lib.tools import BetaAbstractMemoryTool
|
|
432
|
+
|
|
433
|
+
class MyMemoryTool(BetaAbstractMemoryTool):
|
|
434
|
+
def view(self, command): ...
|
|
435
|
+
def create(self, command): ...
|
|
436
|
+
def str_replace(self, command): ...
|
|
437
|
+
def insert(self, command): ...
|
|
438
|
+
def delete(self, command): ...
|
|
439
|
+
def rename(self, command): ...
|
|
440
|
+
|
|
441
|
+
memory = MyMemoryTool()
|
|
442
|
+
|
|
443
|
+
# Use with tool runner
|
|
444
|
+
runner = client.beta.messages.tool_runner(
|
|
445
|
+
model="claude-opus-4-6",
|
|
446
|
+
max_tokens=16000,
|
|
447
|
+
tools=[memory],
|
|
448
|
+
messages=[{"role": "user", "content": "Remember my preferences"}],
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
for message in runner:
|
|
452
|
+
print(message)
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
For full implementation examples, use WebFetch:
|
|
456
|
+
|
|
457
|
+
- `https://github.com/anthropics/anthropic-sdk-python/blob/main/examples/memory/basic.py`
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## Structured Outputs
|
|
462
|
+
|
|
463
|
+
### JSON Outputs (Pydantic — Recommended)
|
|
464
|
+
|
|
465
|
+
```python
|
|
466
|
+
from pydantic import BaseModel
|
|
467
|
+
from typing import List
|
|
468
|
+
import anthropic
|
|
469
|
+
|
|
470
|
+
class ContactInfo(BaseModel):
|
|
471
|
+
name: str
|
|
472
|
+
email: str
|
|
473
|
+
plan: str
|
|
474
|
+
interests: List[str]
|
|
475
|
+
demo_requested: bool
|
|
476
|
+
|
|
477
|
+
client = anthropic.Anthropic()
|
|
478
|
+
|
|
479
|
+
response = client.messages.parse(
|
|
480
|
+
model="claude-opus-4-6",
|
|
481
|
+
max_tokens=16000,
|
|
482
|
+
messages=[{
|
|
483
|
+
"role": "user",
|
|
484
|
+
"content": "Extract: Jane Doe (jane@co.com) wants Enterprise, interested in API and SDKs, wants a demo."
|
|
485
|
+
}],
|
|
486
|
+
output_format=ContactInfo,
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
# response.parsed_output is a validated ContactInfo instance
|
|
490
|
+
contact = response.parsed_output
|
|
491
|
+
print(contact.name) # "Jane Doe"
|
|
492
|
+
print(contact.interests) # ["API", "SDKs"]
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Raw Schema
|
|
496
|
+
|
|
497
|
+
```python
|
|
498
|
+
response = client.messages.create(
|
|
499
|
+
model="claude-opus-4-6",
|
|
500
|
+
max_tokens=16000,
|
|
501
|
+
messages=[{
|
|
502
|
+
"role": "user",
|
|
503
|
+
"content": "Extract info: John Smith (john@example.com) wants the Enterprise plan."
|
|
504
|
+
}],
|
|
505
|
+
output_config={
|
|
506
|
+
"format": {
|
|
507
|
+
"type": "json_schema",
|
|
508
|
+
"schema": {
|
|
509
|
+
"type": "object",
|
|
510
|
+
"properties": {
|
|
511
|
+
"name": {"type": "string"},
|
|
512
|
+
"email": {"type": "string"},
|
|
513
|
+
"plan": {"type": "string"},
|
|
514
|
+
"demo_requested": {"type": "boolean"}
|
|
515
|
+
},
|
|
516
|
+
"required": ["name", "email", "plan", "demo_requested"],
|
|
517
|
+
"additionalProperties": False
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
)
|
|
522
|
+
|
|
523
|
+
import json
|
|
524
|
+
# output_config.format guarantees the first block is text with valid JSON
|
|
525
|
+
text = next(b.text for b in response.content if b.type == "text")
|
|
526
|
+
data = json.loads(text)
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### Strict Tool Use
|
|
530
|
+
|
|
531
|
+
```python
|
|
532
|
+
response = client.messages.create(
|
|
533
|
+
model="claude-opus-4-6",
|
|
534
|
+
max_tokens=16000,
|
|
535
|
+
messages=[{"role": "user", "content": "Book a flight to Tokyo for 2 passengers on March 15"}],
|
|
536
|
+
tools=[{
|
|
537
|
+
"name": "book_flight",
|
|
538
|
+
"description": "Book a flight to a destination",
|
|
539
|
+
"strict": True,
|
|
540
|
+
"input_schema": {
|
|
541
|
+
"type": "object",
|
|
542
|
+
"properties": {
|
|
543
|
+
"destination": {"type": "string"},
|
|
544
|
+
"date": {"type": "string", "format": "date"},
|
|
545
|
+
"passengers": {"type": "integer", "enum": [1, 2, 3, 4, 5, 6, 7, 8]}
|
|
546
|
+
},
|
|
547
|
+
"required": ["destination", "date", "passengers"],
|
|
548
|
+
"additionalProperties": False
|
|
549
|
+
}
|
|
550
|
+
}]
|
|
551
|
+
)
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### Using Both Together
|
|
555
|
+
|
|
556
|
+
```python
|
|
557
|
+
response = client.messages.create(
|
|
558
|
+
model="claude-opus-4-6",
|
|
559
|
+
max_tokens=16000,
|
|
560
|
+
messages=[{"role": "user", "content": "Plan a trip to Paris next month"}],
|
|
561
|
+
output_config={
|
|
562
|
+
"format": {
|
|
563
|
+
"type": "json_schema",
|
|
564
|
+
"schema": {
|
|
565
|
+
"type": "object",
|
|
566
|
+
"properties": {
|
|
567
|
+
"summary": {"type": "string"},
|
|
568
|
+
"next_steps": {"type": "array", "items": {"type": "string"}}
|
|
569
|
+
},
|
|
570
|
+
"required": ["summary", "next_steps"],
|
|
571
|
+
"additionalProperties": False
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
tools=[{
|
|
576
|
+
"name": "search_flights",
|
|
577
|
+
"description": "Search for available flights",
|
|
578
|
+
"strict": True,
|
|
579
|
+
"input_schema": {
|
|
580
|
+
"type": "object",
|
|
581
|
+
"properties": {
|
|
582
|
+
"destination": {"type": "string"},
|
|
583
|
+
"date": {"type": "string", "format": "date"}
|
|
584
|
+
},
|
|
585
|
+
"required": ["destination", "date"],
|
|
586
|
+
"additionalProperties": False
|
|
587
|
+
}
|
|
588
|
+
}]
|
|
589
|
+
)
|
|
590
|
+
```
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Claude API — Ruby
|
|
2
|
+
|
|
3
|
+
> **Note:** The Ruby SDK supports the Claude API. A tool runner is available in beta via `client.beta.messages.tool_runner()`. Agent SDK is not yet available for Ruby.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gem install anthropic
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Client Initialization
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require "anthropic"
|
|
15
|
+
|
|
16
|
+
# Default (uses ANTHROPIC_API_KEY env var)
|
|
17
|
+
client = Anthropic::Client.new
|
|
18
|
+
|
|
19
|
+
# Explicit API key
|
|
20
|
+
client = Anthropic::Client.new(api_key: "your-api-key")
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Basic Message Request
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
message = client.messages.create(
|
|
29
|
+
model: :"claude-opus-4-6",
|
|
30
|
+
max_tokens: 16000,
|
|
31
|
+
messages: [
|
|
32
|
+
{ role: "user", content: "What is the capital of France?" }
|
|
33
|
+
]
|
|
34
|
+
)
|
|
35
|
+
# content is an array of polymorphic block objects (TextBlock, ThinkingBlock,
|
|
36
|
+
# ToolUseBlock, ...). .type is a Symbol — compare with :text, not "text".
|
|
37
|
+
# .text raises NoMethodError on non-TextBlock entries.
|
|
38
|
+
message.content.each do |block|
|
|
39
|
+
puts block.text if block.type == :text
|
|
40
|
+
end
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Streaming
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
stream = client.messages.stream(
|
|
49
|
+
model: :"claude-opus-4-6",
|
|
50
|
+
max_tokens: 64000,
|
|
51
|
+
messages: [{ role: "user", content: "Write a haiku" }]
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
stream.text.each { |text| print(text) }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Tool Use
|
|
60
|
+
|
|
61
|
+
The Ruby SDK supports tool use via raw JSON schema definitions and also provides a beta tool runner for automatic tool execution.
|
|
62
|
+
|
|
63
|
+
### Tool Runner (Beta)
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
class GetWeatherInput < Anthropic::BaseModel
|
|
67
|
+
required :location, String, doc: "City and state, e.g. San Francisco, CA"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class GetWeather < Anthropic::BaseTool
|
|
71
|
+
doc "Get the current weather for a location"
|
|
72
|
+
|
|
73
|
+
input_schema GetWeatherInput
|
|
74
|
+
|
|
75
|
+
def call(input)
|
|
76
|
+
"The weather in #{input.location} is sunny and 72°F."
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
client.beta.messages.tool_runner(
|
|
81
|
+
model: :"claude-opus-4-6",
|
|
82
|
+
max_tokens: 16000,
|
|
83
|
+
tools: [GetWeather.new],
|
|
84
|
+
messages: [{ role: "user", content: "What's the weather in San Francisco?" }]
|
|
85
|
+
).each_message do |message|
|
|
86
|
+
puts message.content
|
|
87
|
+
end
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Manual Loop
|
|
91
|
+
|
|
92
|
+
See the [shared tool use concepts](../shared/tool-use-concepts.md) for the tool definition format and agentic loop pattern.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Prompt Caching
|
|
97
|
+
|
|
98
|
+
`system_:` (trailing underscore — avoids shadowing `Kernel#system`) takes an array of text blocks; set `cache_control` on the last block. Plain hashes work via the `OrHash` type alias. For placement patterns and the silent-invalidator audit checklist, see `shared/prompt-caching.md`.
|
|
99
|
+
|
|
100
|
+
```ruby
|
|
101
|
+
message = client.messages.create(
|
|
102
|
+
model: :"claude-opus-4-6",
|
|
103
|
+
max_tokens: 16000,
|
|
104
|
+
system_: [
|
|
105
|
+
{ type: "text", text: long_system_prompt, cache_control: { type: "ephemeral" } }
|
|
106
|
+
],
|
|
107
|
+
messages: [{ role: "user", content: "Summarize the key points" }]
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
For 1-hour TTL: `cache_control: { type: "ephemeral", ttl: "1h" }`. There's also a top-level `cache_control:` on `messages.create` that auto-places on the last cacheable block.
|
|
112
|
+
|
|
113
|
+
Verify hits via `message.usage.cache_creation_input_tokens` / `message.usage.cache_read_input_tokens`.
|