""" | |
This module contains tools for managing Github. | |
""" | |
from pmcp.mcp_server.github_server.services.repo_to_text import RepoToTextService | |
from pmcp.mcp_server.github_server.github import github_client | |
from mcp.server.fastmcp import Context | |
service = RepoToTextService(github_client) | |
async def get_repo_to_text(ctx: Context, repo: str) -> str: | |
"""Retrieves the repo structure and the repo content as text. | |
Args: | |
repo (str): The name of the repository. | |
Returns: | |
str: The content of the repository as text. | |
""" | |
try: | |
content = await service.get_repo_to_text(repo) | |
return content | |
except Exception as e: | |
error_msg = f"Failed to get content from repo: {str(e)}" | |
await ctx.error(error_msg) | |
raise |