Skip to main content
Glama
efremidze

swift-patterns-mcp

list_content_sources

Retrieve a list of all available content sources and their current status for curated Swift and SwiftUI best practices.

Instructions

List all available content sources and their status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for 'list_content_sources' tool. Calls context.sourceManager.getAllSources() to retrieve all content sources, then formats them into a markdown response separating free (always available) and premium (optional, with status indicators like ✅ Enabled, ⚙️ Configured but disabled, ⬜ Not configured) sources.
    export const listContentSourcesHandler: ToolHandler = async (_args, context) => {
      const allSources = context.sourceManager.getAllSources();
    
      const freeList = allSources
        .filter(s => s.type === 'free')
        .map(s => `- ✅ **${s.name}** - ${s.description}`)
        .join('\n');
    
      const premiumList = allSources
        .filter(s => s.type === 'premium')
        .map(s => {
          const status = s.isConfigured && s.isEnabled ? '✅' :
                        s.isConfigured ? '⚙️' : '⬜';
          return `- ${status} **${s.name}** - ${s.description}${s.isConfigured ? '' : ' (Setup required)'}`;
        })
        .join('\n');
    
      return createTextResponse(`# Content Sources
    
    ## Free Sources (Always Available)
    ${freeList}
    
    ## Premium Sources (Optional)
    ${premiumList}
    
    ## Legend
    ✅ Enabled | ⚙️ Configured but disabled | ⬜ Not configured
    
    To enable premium sources:
    \`\`\`
    swift-patterns-mcp patreon setup
    \`\`\`
    `);
    };
  • Schema/registration definition for the 'list_content_sources' tool. Specifies the tool name, description ('List all available content sources and their status'), and an empty inputSchema (no required parameters). Part of CORE_TOOLS array always available.
    {
      name: "list_content_sources",
      description: "List all available content sources and their status",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Import of listContentSourcesHandler from its handler module and registration via registerHandler('list_content_sources', listContentSourcesHandler) to wire the tool name to its handler function.
    import { listContentSourcesHandler } from './handlers/listContentSources.js';
    import { enableSourceHandler } from './handlers/enableSource.js';
    import { setupPatreonHandler } from './handlers/setupPatreon.js';
    import { getPatreonPatternsHandler } from './handlers/getPatreonPatterns.js';
    
    registerHandler('get_swift_pattern', getSwiftPatternHandler);
    registerHandler('search_swift_content', searchSwiftContentHandler);
    registerHandler('list_content_sources', listContentSourcesHandler);
  • SourceManager.getAllSources() method used by the handler. Returns all AVAILABLE_SOURCES enriched with isEnabled and isConfigured boolean flags, enabling the handler to display status emojis.
    getAllSources(): Array<ContentSource & { 
      isEnabled: boolean;
      isConfigured: boolean;
    }> {
      return AVAILABLE_SOURCES.map(source => ({
        ...source,
        isEnabled: this.config.sources[source.id]?.enabled || false,
        isConfigured: this.isSourceConfigured(source.id),
      }));
    }
  • createTextResponse utility used by the handler to wrap the markdown string into the standard ToolResponse format with content type 'text'.
    export function createTextResponse(text: string): ToolResponse {
      return {
        content: [{
          type: "text",
          text,
        }],
      };
    }
Behavior3/5

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

With no annotations, the description carries full burden. It correctly indicates a read operation (list) without side effects, but does not elaborate on rate limits, authentication, or status meaning.

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?

One sentence of 7 words, front-loaded with the core action. No wasted words.

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 zero-parameter tool without output schema, the description states the return of 'all available content sources and their status', which is adequate but lacks details on the data structure or status values.

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

Parameters4/5

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

There are zero parameters, so baseline is 4. The description adds no parameter meaning since none exist, but this is appropriate.

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

Purpose5/5

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

The description uses the specific verb 'list' and resource 'content sources', and includes 'status', clearly distinguishing it from sibling tools like enable_source and search_swift_content.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description simply states what it does, leaving the agent to infer context from sibling names.

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