"""Resources exposed by PKB."""

from mcp.shared.exceptions import McpError
from mcp.types import ErrorData, METHOD_NOT_FOUND

from pkb.tools import NOTES


def get_note(title: str) -> str:
    """Return the body of one note by title. URI: pkb://notes/{title}."""
    if title not in NOTES:
        raise McpError(ErrorData(
            code=METHOD_NOT_FOUND,
            message=f"unknown note: {title}",
        ))
    return NOTES[title]


def about() -> str:
    """Static resource describing the PKB server. URI: pkb://about."""
    return (
        "PKB — Personal Knowledge Base MCP server (course sample).\n"
        "Exposes notes via pkb://notes/{title} and tools for searching them."
    )
