search_docs
Search Apple developer documentation semantically with relevance scoring to find API references, code examples, and related topics.
Instructions
🔍 SEMANTIC SEARCH through 16,253 Apple documentation pages with intelligent relevance scoring.
SEARCH STRATEGY: • BROAD→NARROW: Start with general concepts ("SwiftUI animation") then narrow down ("SwiftUI keyframe animator") • ITERATE: If results aren't specific enough, reformulate with more precise terms • EXPLORE: Use limit 8-10 for initial exploration, limit 3-5 for focused searches • 🔗 RELATED MODE: Set includeRelated=true to auto-discover connected topics
QUERY EXAMPLES:
âś… GOOD: "SwiftUI custom transition animation", "Core Data CloudKit conflict resolution"
âś… GOOD: "NSFetchRequest predicate performance", "UIKit navigation controller delegate"
✅ WITH RELATED: "SwiftUI Button" + includeRelated=true → 3 main + 5 related (ButtonStyle, UIButton, design guidelines) = comprehensive topic coverage
❌ AVOID: Single words like "Button" or "Core Data" - too broad
❌ AVOID: Non-Apple terms like "React" or "Android"
RELEVANCE SCORES:
• 60%+: Highly relevant, likely contains what you need
• 50-59%: Good match, worth investigating
• 40-49%: Partial match, may have related information
• <40%: Weak match, consider refining search
🔗 ENHANCED BY DEFAULT: Every search includes 3-6 intelligently related documents • Semantic similarity using existing embeddings (NO extra OpenAI API calls!) • Intelligent relationship classification: 🔄 Migration, 🆕 Alternatives, ⚡ Performance, 📋 Examples • Smart threshold adaptation based on main result quality (75-85% similarity scores) • Framework-aware connections: SceneKit→RealityKit, UIKit→SwiftUI, Core Image→Metal • Quality-first approach: vector-based semantic matching replaces keyword search • Use includeRelated=false to disable and get only main search results
WORKFLOW: Use search_docs for exploration → get_doc for detailed analysis → repeat with refined queries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | RESULT COUNT: 8-10 for exploration, 3-5 for focused search. More results = broader overview. | |
| query | Yes | SEARCH QUERY: Use 2-4 specific keywords. Examples: "SwiftUI custom animation", "Core Data fetch performance", "UIKit navigation delegate methods" | |
| minSimilarity | No | RELEVANCE THRESHOLD: 0.3 (default) for broad search, 0.5+ for highly specific results. Lower = more results. | |
| includeContent | No | CONTENT PREVIEW: Always true for decision making. Provides snippet to evaluate relevance. | |
| includeRelated | No | 🔗 VECTOR-BASED AUTO-DISCOVER: Find semantically related documents using embeddings similarity (NOW ENABLED BY DEFAULT). Adds 3-6 intelligently classified docs (🔄 Migration guides, 🆕 Modern alternatives, ⚡ Performance tips, 📋 Code examples). Set to false to show only main results. | |
| maxContentChars | No | SNIPPET SIZE: 150-200 for quick scan, 300+ for detailed preview. Balance overview vs detail. | |
| showCodePreview | No | đź’» CODE PREVIEW: Show preview of first Swift code block in each result. Perfect for AI agents to quickly see if document contains useful code examples. Use with get_code_examples(docId) for full code extraction. |