feat: add AI Workspace Menu Bar App design and enhance MCP server with resource definitions and read functionality
This commit is contained in:
@@ -34,6 +34,37 @@ class ContextMCPTests(unittest.TestCase):
|
||||
self.assertIn("project_search_memory", names)
|
||||
self.assertIn("communication_latest", names)
|
||||
|
||||
def test_initialize_response_declares_resources(self) -> None:
|
||||
response = server.handle_request({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": server.PROTOCOL_VERSION}})
|
||||
|
||||
self.assertIn("resources", response["result"]["capabilities"])
|
||||
|
||||
def test_resources_list_includes_current_work(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
profile = root / "profiles" / "fidelity" / "profile.md"
|
||||
profile.parent.mkdir(parents=True)
|
||||
profile.write_text("# Fidelity", encoding="utf-8")
|
||||
with patch.object(server, "ROOT", root):
|
||||
response = server.handle_request({"jsonrpc": "2.0", "id": 1, "method": "resources/list"})
|
||||
|
||||
uris = {item["uri"] for item in response["result"]["resources"]}
|
||||
self.assertIn("aiw://profiles/fidelity/current-work", uris)
|
||||
|
||||
def test_resources_read_current_work(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
profile = root / "profiles" / "fidelity" / "profile.md"
|
||||
current = root / "project-knowledge" / "01-current" / "current-work.md"
|
||||
profile.parent.mkdir(parents=True)
|
||||
current.parent.mkdir(parents=True)
|
||||
profile.write_text("# Fidelity", encoding="utf-8")
|
||||
current.write_text("# Current\nImportant", encoding="utf-8")
|
||||
with patch.object(server, "ROOT", root):
|
||||
response = server.handle_request({"jsonrpc": "2.0", "id": 1, "method": "resources/read", "params": {"uri": "aiw://profiles/fidelity/current-work"}})
|
||||
|
||||
self.assertEqual(response["result"]["contents"][0]["text"], "# Current\nImportant")
|
||||
|
||||
def test_unknown_tool_returns_protocol_error(self) -> None:
|
||||
response = server.handle_request({"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "missing", "arguments": {}}})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user