Skip to main content
Glama
apolosan

Design Patterns MCP Server

by apolosan
chain-of-responsibility.json1.18 kB
{ "id": "chain-of-responsibility", "name": "Chain of Responsibility", "category": "Behavioral", "description": "Passes requests along a chain of handlers until one handles it", "when_to_use": "Multiple handlers\nDynamic handler assignment\nDecoupling", "benefits": "Reduced coupling\nFlexibility\nSingle Responsibility", "drawbacks": "No guarantee of handling\nPerformance concerns", "use_cases": "Event handling\nMiddleware chains\nApproval workflows", "complexity": "Medium", "tags": [ "behavioral", "chain", "delegation" ], "examples": { "typescript": { "language": "typescript", "code": "abstract class Handler {\n protected next?: Handler;\n setNext(handler: Handler) { this.next = handler; return handler; }\n \n handle(request: string): void {\n if (this.next) this.next.handle(request);\n }\n}\n\nclass AuthHandler extends Handler {\n handle(request: string) {\n if (request.includes('auth')) {\n console.log('Authenticated');\n } else {\n super.handle(request);\n }\n }\n}\n\n// Usage: pass request along chain\nconst chain = new AuthHandler();\nchain.handle('auth:user');" } } }

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/apolosan/design_patterns_mcp'

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