{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "designpattern.fyi MCP Server Tools",
  "description": "Model Context Protocol tools definition for querying designpattern.fyi pattern catalog from AI coding assistants (Claude, Cursor, Copilot).",
  "tools": [
    {
      "name": "search_patterns",
      "description": "Search the designpattern.fyi catalog of 758+ design patterns by semantic query, category, or problem domain. Use this when an agent needs to find relevant architectural patterns for a specific design challenge, system requirement, or technology stack. Returns pattern IDs, names, categories, and brief descriptions for further exploration.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Semantic search term or problem description (e.g., 'handle service failures', 'agent memory architecture', 'distributed transactions', 'API rate limiting'). Matches against pattern names, descriptions, use cases, and technical domains."
          },
          "category": {
            "type": "string",
            "description": "Optional category filter to narrow search scope. Valid values: 'agentic_ai', 'cloud', 'microservices', 'solid', 'owasp_llm', 'owasp_agentic_ai', 'algorithms', 'data_structures', 'event_driven_architecture', 'integration', 'data_science', 'language_models', 'machine_learning'.",
            "enum": ["agentic_ai", "cloud", "microservices", "solid", "owasp_llm", "owasp_agentic_ai", "algorithms", "data_structures", "event_driven_architecture", "integration", "data_science", "language_models", "machine_learning"]
          },
          "limit": {
            "type": "integer",
            "default": 10,
            "minimum": 1,
            "maximum": 50,
            "description": "Maximum number of patterns to return (1-50). Use lower limits for focused queries, higher limits for broad exploration."
          }
        },
        "required": [
          "query"
        ]
      },
      "annotations": {
        "capability": "read-only",
        "idempotent": true
      }
    },
    {
      "name": "get_pattern",
      "description": "Retrieve complete details for a specific design pattern including intent, context, solution, use cases, pros/cons, code examples, and source references. Use this after search_patterns to get full implementation guidance and architectural trade-off analysis for a selected pattern.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "pattern_id": {
            "type": "string",
            "description": "Unique pattern identifier in snake_case format (e.g., 'circuit_breaker', 'saga_orchestration', 'working_memory', 'reflection_pattern'). Must be a valid pattern ID from the catalog.",
            "pattern": "^[a-z_]+$"
          }
        },
        "required": [
          "pattern_id"
        ]
      },
      "annotations": {
        "capability": "read-only",
        "idempotent": true
      }
    },
    {
      "name": "list_categories",
      "description": "List all available pattern categories, subcategories, pattern counts, and hierarchical structure. Use this to understand the catalog taxonomy, discover available pattern domains, or get category metadata for filtering. Essential for agents that need to explore the pattern space systematically.",
      "inputSchema": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "annotations": {
        "capability": "read-only",
        "idempotent": true
      }
    },
    {
      "name": "get_agent_instructions",
      "description": "Fetch comprehensive when-to-use guidance and architectural calling instructions for AI agents. Returns specific scenarios where designpattern.fyi should be consulted, recommended agent workflows, and integration examples. Use this to determine if designpattern.fyi is relevant for the current task.",
      "inputSchema": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "annotations": {
        "capability": "read-only",
        "idempotent": true
      }
    }
  ]
}