#!/usr/bin/env python3
"""Test script to check if OKR tools are properly registered."""
import sys
import os
# Add the current directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
def test_tool_registration():
"""Test if tools are properly registered without running the server."""
try:
# Import FastMCP
from fastmcp import FastMCP
# Create a mock FastMCP instance
mcp = FastMCP("Test Server")
# Import the tool functions directly
from agileplace_mcp.tools import okr, okr_activities
print("✓ Successfully imported OKR modules")
# Check if the functions exist
okr_functions = [
'create_objective',
'create_key_result',
'update_objective',
'update_key_result',
'get_objectives_by_board_id',
'get_key_results_by_objective_id'
]
activities_functions = [
'connect_activities_to_key_result',
'create_activity',
'list_activities',
'list_activity_containers',
'search_activities',
'list_activity_types',
'search_users',
'get_current_user'
]
print("\nOKR Functions:")
for func_name in okr_functions:
if hasattr(okr, func_name):
print(f" ✓ {func_name}")
else:
print(f" ✗ {func_name} - NOT FOUND")
print("\nActivity Functions:")
for func_name in activities_functions:
if hasattr(okr_activities, func_name):
print(f" ✓ {func_name}")
else:
print(f" ✗ {func_name} - NOT FOUND")
# Test if we can decorate functions (this is the key test)
print("\nTesting FastMCP tool registration:")
@mcp.tool()
async def test_tool():
"""Test tool to verify registration works."""
return {"status": "success"}
if hasattr(mcp, 'tools') and len(mcp.tools) > 0:
print(f" ✓ FastMCP tool registration works - {len(mcp.tools)} tools registered")
for tool_name in mcp.tools:
print(f" - {tool_name}")
else:
print(" ✗ FastMCP tool registration failed")
return True
except ImportError as e:
print(f"✗ Import error: {e}")
return False
except Exception as e:
print(f"✗ Error: {e}")
return False
if __name__ == "__main__":
print("Testing AgilePlace MCP Server Tool Registration")
print("=" * 50)
success = test_tool_registration()
if success:
print("\n✓ All tests passed!")
else:
print("\n✗ Some tests failed!")
sys.exit(1)