Skip to main content
Glama
efremidze

swift-patterns-mcp

enable_source

Activates a content source to access Swift and SwiftUI best practices. Premium sources require separate setup.

Instructions

Enable a content source (requires setup for premium sources)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesSource ID (e.g., 'patreon')

Implementation Reference

  • The main handler function for the 'enable_source' tool. It validates the 'source' argument, checks if the source exists, verifies configuration for premium sources, and calls sourceManager.enableSource() to enable it.
    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 tool registration metadata including name, description, and JSON Schema input schema for 'enable_source'.
    {
      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"],
      },
    },
  • Registration of the 'enable_source' tool name to the enableSourceHandler via registerHandler.
    registerHandler('enable_source', enableSourceHandler);
  • The SourceManager.enableSource() method that actually persists the enabled state for a source ID, modifying the config and saving it.
    enableSource(id: string): boolean {
      const source = this.getSource(id);
      if (!source) return false;
      
      // Check if requires configuration
      if (source.requiresAuth && !this.isSourceConfigured(id)) {
        throw new Error(
          `Source "${source.name}" requires configuration. Run: swift-patterns-mcp ${id} setup`
        );
      }
      
      if (!this.config.sources[id]) {
        this.config.sources[id] = { enabled: true, configured: !source.requiresAuth };
      } else {
        this.config.sources[id].enabled = true;
      }
      
      this.saveConfig();
      return true;
    }
  • Mock implementation of enableSource used in test fixtures.
    enableSource: vi.fn(),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It only mentions setup requirements, omitting details on side effects, permissions, or what happens upon success/failure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence with no padding, effectively conveying the core action and a key constraint.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool, the description hints at setup requirements but lacks details on expected outcomes or error conditions, leaving some gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already describes the single parameter with an example. The description adds no extra semantic value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Enable' and the resource 'content source', and adds a caveat about setup for premium sources, distinguishing it from sibling query tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies that enabling premium sources requires prior setup, but does not explicitly state when to use this tool vs alternatives or provide exclusion conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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-patterns-mcp'

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