#!/usr/bin/env python3
"""Simple test script to check if OKR functions exist."""
import sys
import os
# Add the current directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
def test_functions_exist():
"""Test if OKR functions exist without FastMCP."""
try:
print("Testing OKR module functions...")
# Import OKR modules
from agileplace_mcp.tools import okr, okr_activities
# Check OKR functions
okr_functions = [
'create_objective',
'create_key_result',
'update_objective',
'update_key_result',
'get_objectives_by_board_id',
'get_key_results_by_objective_id'
]
print("\nOKR Functions:")
okr_count = 0
for func_name in okr_functions:
if hasattr(okr, func_name):
print(f" ✓ {func_name}")
okr_count += 1
else:
print(f" ✗ {func_name} - NOT FOUND")
# Check Activity functions
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("\nActivity Functions:")
activities_count = 0
for func_name in activities_functions:
if hasattr(okr_activities, func_name):
print(f" ✓ {func_name}")
activities_count += 1
else:
print(f" ✗ {func_name} - NOT FOUND")
# Check data models
print("\nData Models:")
from agileplace_mcp.models import (
WorkItemContainer, WorkItem, ActivityInput, ConnectActivitiesInput,
Objective, KeyResult
)
print(" ✓ WorkItemContainer")
print(" ✓ WorkItem")
print(" ✓ ActivityInput")
print(" ✓ ConnectActivitiesInput")
print(" ✓ Objective")
print(" ✓ KeyResult")
print(f"\nSummary:")
print(f" OKR Functions: {okr_count}/{len(okr_functions)}")
print(f" Activity Functions: {activities_count}/{len(activities_functions)}")
print(f" Data Models: 6/6")
if okr_count == len(okr_functions) and activities_count == len(activities_functions):
print("\n✓ All functions and models exist!")
return True
else:
print(f"\n✗ Missing functions!")
return False
except ImportError as e:
print(f"✗ Import error: {e}")
return False
except Exception as e:
print(f"✗ Error: {e}")
return False
def test_server_import():
"""Test if server.py can be imported (this will catch syntax errors)."""
try:
print("\nTesting server.py import...")
# This will fail if there are syntax errors
import importlib.util
spec = importlib.util.spec_from_file_location("server", "agileplace_mcp/agileplace_mcp/server.py")
server_module = importlib.util.module_from_spec(spec)
# Don't actually execute the server, just check if it can be parsed
print(" ✓ server.py can be parsed (no syntax errors)")
return True
except SyntaxError as e:
print(f" ✗ Syntax error in server.py: {e}")
return False
except Exception as e:
print(f" ✗ Error importing server.py: {e}")
return False
if __name__ == "__main__":
print("Testing AgilePlace MCP Server Components")
print("=" * 50)
functions_ok = test_functions_exist()
server_ok = test_server_import()
if functions_ok and server_ok:
print("\n✓ All tests passed!")
print("\nThe OKR tools should be available when FastMCP is properly installed.")
print("The issue with not seeing tools in FastMCP is likely due to:")
print("1. FastMCP not being installed")
print("2. The server needing to be restarted after changes")
print("3. Import order issues (which we've fixed)")
else:
print("\n✗ Some tests failed!")
sys.exit(1)