File size: 496 Bytes
9ce984a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import annotations

from mcp_server.loader import read_code


__all__ = ["get_code"]


def get_code(path: str) -> str:
    """
    Return full Python source code for a knowledge base file.

    Args:
        path: Either:
            - "knowledge_base/<category>/<file>.py"
            - "<category>/<file>.py"

    Raises:
        ValueError, FileNotFoundError per validation rules.

    Returns:
        The full UTF-8 text of the Python file.
    """
    return read_code(path)