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
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_content_sources"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
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 \`\`\` `); }; - src/tools/registration.ts:50-57 (schema)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: {}, }, }, - src/tools/index.ts:10-17 (registration)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); - src/config/sources.ts:255-264 (helper)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), })); } - src/utils/response-helpers.ts:56-63 (helper)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, }], }; }