enable_source
Activate content sources to access curated Swift and SwiftUI best practices from leading iOS developers, including patterns and real-world code examples.
Instructions
Enable a content source (requires setup for premium sources)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Source ID (e.g., 'patreon') |
Implementation Reference
- src/tools/handlers/enableSource.ts:7-34 (handler)The core logic for the 'enable_source' tool handler. It validates the source ID, checks if it exists, ensures authentication if required, and then enables the source via the sourceManager.
export const enableSourceHandler: ToolHandler = async (args, context) => { const sourceId = validateRequiredString(args, 'source', 'Usage: enable_source({ source: "patreon" })'); if (isValidationError(sourceId)) return sourceId; const source = context.sourceManager.getSource(sourceId); if (!source) { return createErrorResponse(`Unknown source: "${sourceId}" Available sources: ${context.sourceManager.getAllSources().map(s => `- ${s.id}: ${s.name}`).join('\n')}`); } if (source.requiresAuth && !context.sourceManager.isSourceConfigured(sourceId)) { return createTextResponse(`⚙️ ${source.name} requires setup first. Run: swift-patterns-mcp ${sourceId} setup This will guide you through: ${sourceId === 'patreon' ? '- Patreon OAuth authentication\n- Connecting your subscriptions' : '- Authentication setup'}`); } context.sourceManager.enableSource(sourceId); return createTextResponse(`✅ ${source.name} enabled! You can now use patterns from this source.`); }; - src/tools/registration.ts:59-71 (schema)The schema definition for 'enable_source' in the tool registration list.
name: "enable_source", description: "Enable a content source (requires setup for premium sources)", inputSchema: { type: "object", properties: { source: { type: "string", description: "Source ID (e.g., 'patreon')", }, }, required: ["source"], }, },