get_code_examples
Extract all code examples from a specific Apple documentation document using its doc ID. Get full context and explanations for each code block.
Instructions
š CONTEXTUAL CODE EXTRACTION: Extract code examples from a specific document you already found.
WORKFLOW INTEGRATION: ⢠Use after search_docs: See codeBlocks: 5 ā get_code_examples(doc_id) ā get those 5 examples ⢠Perfect for AI agents: Found interesting document ā extract its code without re-searching ⢠Contextual approach: Work with specific documents rather than broad searches
WHAT YOU GET: ⢠All code examples from the specified document ⢠Full context and explanations around each code block ⢠Categorization and complexity analysis ⢠Same rich metadata as extract_code_examples
USAGE PATTERN:
search_docs("SwiftUI navigation") ā find relevant documents
See result shows "codeBlocks: 7"
get_code_examples(document_id) ā get all 7 examples with context
PERFECT FOR: AI agents who want to drill down into specific documents after initial search.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"docId": "<docId>"
},
"name": "get_code_examples"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docId | Yes | DOCUMENT ID: The id field from search_docs results. Extract code examples from this specific document. |