feat: add file asset listing prompt

Expose list_file_assets so agents can browse allowed source files without relying on empty search queries.

Add a how_to_use_wiki_file_assets prompt to make the MCP purpose and workflow visible to clients that inspect prompts/resources before tools.
This commit is contained in:
Codex
2026-07-05 12:25:36 +00:00
parent a6ef696d84
commit 57b98f1979
2 changed files with 56 additions and 0 deletions
+14
View File
@@ -100,12 +100,15 @@ class RemoteMcpServerTests(unittest.TestCase):
def test_create_server_uses_file_asset_service_name(self):
class FakeMCP:
names = []
tool_names = []
prompt_names = []
def __init__(self, name, **kwargs):
self.names.append(name)
def tool(self):
def decorator(func):
self.tool_names.append(func.__name__)
return func
return decorator
@@ -116,6 +119,13 @@ class RemoteMcpServerTests(unittest.TestCase):
return decorator
def prompt(self, name=None, **_kwargs):
def decorator(func):
self.prompt_names.append(name or func.__name__)
return func
return decorator
with (
tempfile.TemporaryDirectory() as tmp,
patch.dict("sys.modules", {"mcp.server.fastmcp": type("Mod", (), {"FastMCP": FakeMCP})()}),
@@ -124,6 +134,10 @@ class RemoteMcpServerTests(unittest.TestCase):
self.assertIsInstance(server, FakeMCP)
self.assertEqual(FakeMCP.names[-1], "wiki-file-assets")
self.assertIn("search_file_assets", FakeMCP.tool_names)
self.assertIn("list_file_assets", FakeMCP.tool_names)
self.assertIn("get_file_asset_metadata", FakeMCP.tool_names)
self.assertIn("how_to_use_wiki_file_assets", FakeMCP.prompt_names)
def test_run_http_server_fails_before_server_creation_without_token(self):
with tempfile.TemporaryDirectory() as tmp: