Not human search mcp

From paulpas/agent-skill-router · View interactive version

Not human search mcp is an AI agent skill from the GitHub repository paulpas/agent-skill-router. Implements intelligent not human search mcp with multi-factor skill selection, fallback chains, and adherence to the 5 Laws of Elegant Defense

How to use this skill

Skill file

Not Human Search Mcp

Orchestrates intelligent skill selection and execution for not human search mcp workflows. Applies the 5 Laws of Elegant Defense to guide data naturally through the orchestration pipeline, preventing errors before they occur. Selects optimal skills based on multi-factor scoring including text similarity, historical performance, and system availability.

TL;DR Checklist

┌───────────────────────────────────────────────────────────────────────────────┐

│ Orchestration Flow │

└───────────────────────────────────────────────────────────────────────────────┘

User Request

↓

┌─────────────────┐

│ Parse Request │

│ & Extract │

│ Features │

└────────┬────────┘

↓

┌─────────────────────────────────────────────────────────────────────┐

│ Evaluate Available Skills │

│ │

│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │

│ │ Skill A │ │ Skill B │ │ Skill C │ │

│ │ - Match Score│ │ - Match Score│ │ - Match Score│ │

│ │ - Confidence │ │ - Confidence │ │ - Confidence │ │

│ │ - History │ │ - History │ │ - History │ │

│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │

│ │ │ │ │

│ └─────────────────┴─────────────────┘ │

│ ↓ │

│ Select Best Skill │

└─────────────────────────────────────────────────────────────────────┘

↓

┌─────────────────┐

│ Execute Skill │

└────────┬────────┘

↓

┌─────────────────┐

│ Handle Result │

└────────┬────────┘

↓

┌─────────────────────────────────────────────────────────────────────┐

│ Error Handling & Fallback │

│ │

│ Success? ────────► Return Result │

│ │

│ Fail? ────────┐ │

│ ↓ │

│ ┌──────────────────────────────────────────────────────────┐ │

│ │ Fallback Chain │ │

│ │ │ │

│ │ 1. Retry with adjusted parameters │ │

│ │ 2. Try Alternative Skill (if available) │ │

│ │ 3. Defer to Human Operator (if critical) │ │

│ │ 4. Log & Return Error │ │

│ └──────────────────────────────────────────────────────────┘ │

└─────────────────────────────────────────────────────────────────────┘

When to Use

Use this skill when:

When NOT to Use

Avoid this skill for:

Core Workflow

  1. Parse and Analyze Request - Extract intent, entities, and constraints from user input.

Checkpoint: All required parameters must be present and in valid format before proceeding.

  1. Score Available Skills - Calculate match scores using multi-factor algorithm:

Checkpoint: Skip to fallback if no skill scores above threshold.

  1. Select Optimal Skill - Choose skill with highest score that meets minimum confidence.

Checkpoint: Verify skill has not been disabled or deprecated.

  1. Execute with Fallback - Run skill execution wrapped in retry and fallback logic.

Checkpoint: Log all execution attempts for audit trail.

  1. Return or Fallback - Either return successful result or apply fallback chain:

Checkpoint: Record outcome with timing and confidence metadata.

Implementation Patterns

Pattern 1: Skill Selection Logic

def route_search_query(
    query: str,
    mcp_tools: List[Dict],
    query_config: Dict
) -> Dict:
    """Route a search query to the optimal MCP search tool.
    
    Analyzes query intent and constraints to select the best search backend.
    Implements Law 2: Parse inputs at boundary.
    """
    if not query or not query.strip():
        raise ValueError("Search query cannot be empty")
        
    # Extract query features for routing
    intent = _classify_intent(query)
    source_preference = query_config.get("preferred_source", "auto")
    
    candidates = []
    for tool in mcp_tools:
        if tool["type"] == "search" and tool.get("status") == "active":
            score = _calculate_search_match(intent, source_preference, tool)
            candidates.append({"tool": tool, "score": score})
            
    if not candidates:
        return {"error": "No active search tools available", "fallback": "cache"}
        
    # Sort by score and return best match with routing metadata
    candidates.sort(key=lambda x: x["score"], reverse=True)
    best = candidates[0]
    
    return {
        "selected_tool": best["tool"]["name"],
        "routing_metadata": {
            "intent": intent,
            "score": best["score"],
            "timestamp": time.time()
        }
    }

Pattern 2: Execution with Fallback

def execute_search_with_fallback(
    routing_result: Dict,
    query: str,
    search_config: Dict
) -> Dict:
    """Execute search with MCP tool and implement search-specific fallback chain.
    
    Implements Law 4: Fail fast, fail loud. Handles rate limits, timeouts, and empty results.
    Fallback: retry with expanded query -> fallback to cached index -> return partial results.
    """
    tool_name = routing_result["selected_tool"]
    max_retries = search_config.get("max_retries", 2)
    
    for attempt in range(max_retries + 1):
        try:
            # Call MCP search tool directly
            raw_results = _call_mcp_search_tool(tool_name, query)
            
            # Validate results (Law 3: Atomic Predictability)
            validated_results = _validate_search_results(raw_results)
            
            return {
                "success": True,
                "tool_used": tool_name,
                "results": validated_results,
                "attempts": attempt + 1,
                "latency_ms": time.time() * 1000
            }
            
        except MCPRateLimitError:
            if attempt < max_retries:
                time.sleep(2 ** attempt)  # Exponential backoff
                continue
            return _fallback_to_cached_index(query, search_config)
            
        except MCPTimeoutError:
            if attempt < max_retries:
                continue
            return _fallback_to_knowledge_base(query, search_config)
            
        except EmptyResultError:
            # Expand query and retry once
            if attempt == 0:
                query = _expand_query(query)
                continue
            return _fallback_to_partial_results(query, search_config)
            
    # All retries exhausted
    raise SearchExecutionError(f"Search failed for '{query}' after {max_retries + 1} attempts")

MUST DO

MUST NOT DO

TL;DR Checklist

TL;DR for Code Generation

Output Template

When applying this skill, produce:

  1. Selected Skills - List of skill names with confidence scores
  2. Selection Rationale - Why each skill was chosen (match score, history, availability)
  3. Execution Plan - Order of execution with dependencies
  4. Fallback Strategy - Which fallback skills will be tried and in what order
  5. Risk Assessment - Any potential failure points and their impact
  6. Timing Estimates - Expected latency including fallback scenarios

Related Skills

| Skill | Purpose |

|



Constraints

MUST DO

MUST NOT DO

Live References

Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.