Skip to main content
Glama

Agent Knowledge MCP

test_pattern_matching.pyโ€ข2.35 kB
#!/usr/bin/env python3 """Test script to verify error pattern matching improvements.""" def test_error_patterns(): """Test the enhanced error pattern matching logic.""" # Test cases for different error message formats test_errors = [ "index_not_found_exception: no such index [my_index]", "IndexNotFoundError: no such index", "The index [knowledge_base] does not exist", "Index not found: knowledge_base", "NOT_FOUND exception in elasticsearch", "Connection refused", "permission denied", "mapping error occurred" ] print("๐Ÿงช Testing Enhanced Error Pattern Matching") print("=" * 50) for i, error_msg in enumerate(test_errors, 1): print(f"\n{i}. Testing error: '{error_msg}'") error_str = error_msg.lower() # Apply the enhanced pattern matching logic if "connection" in error_str or "refused" in error_str: result = "๐Ÿ”Œ Connection Error detected" elif ("not_found" in error_str or "not found" in error_str or "does not exist" in error_str) or "index_not_found_exception" in error_str or "no such index" in error_str: # Check if it's specifically an index not found error if ("index" in error_str and ("not found" in error_str or "not_found" in error_str or "does not exist" in error_str)) or "index_not_found_exception" in error_str or "no such index" in error_str: result = "๐Ÿ“ Index Not Found detected (with 4-step guidance)" else: result = "๐Ÿ“„ Document Not Found detected" elif "permission" in error_str or "forbidden" in error_str: result = "๐Ÿ”’ Permission Error detected" elif "mapping" in error_str or "invalid" in error_str: result = "๐Ÿ“ Mapping Error detected" else: result = "โš ๏ธ Unknown Error (fallback)" print(f" โ†’ {result}") print(f"\nโœ… Pattern matching test completed!") print("๐Ÿ“‹ Summary: Enhanced patterns now detect:") print(" โ€ข index_not_found_exception") print(" โ€ข no such index") print(" โ€ข traditional not_found/not found patterns") print(" โ€ข proper index vs document error distinction") if __name__ == "__main__": test_error_patterns()

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/itshare4u/AgentKnowledgeMCP'

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