Spaces:
Running
Running
File size: 866 Bytes
d557d77 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
"""MCP resource definitions for CodeRAG."""
import json
from coderag.mcp.handlers import get_mcp_handlers
from coderag.mcp.server import mcp
@mcp.resource("repository://{repo_id}")
async def get_repository_resource(repo_id: str) -> str:
"""Get repository metadata as JSON.
Args:
repo_id: Repository ID (full or first 8 characters)
Returns:
Repository metadata as JSON string
"""
handlers = get_mcp_handlers()
result = await handlers.get_repository_info(repo_id=repo_id)
return json.dumps(result, indent=2)
@mcp.resource("repositories://list")
async def get_repositories_list() -> str:
"""Get all repositories as JSON.
Returns:
List of all repositories as JSON string
"""
handlers = get_mcp_handlers()
result = await handlers.list_repositories()
return json.dumps(result, indent=2)
|