Skip to main content
Glama
efremidze

swift-patterns-mcp

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
NameRequiredDescriptionDefault
sourceYesSource ID (e.g., 'patreon')

Implementation Reference

  • 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.`);
    };
  • 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"],
      },
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/efremidze/swift-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server