(name: str, fn: Any, functions_dir: Path)
| 123 | |
| 124 | |
| 125 | def _build_function_metadata(name: str, fn: Any, functions_dir: Path) -> FunctionMetadata: |
| 126 | signature = inspect.signature(fn) |
| 127 | annotations = _resolve_annotations(fn) |
| 128 | |
| 129 | description = _extract_description(fn) |
| 130 | schema = _build_parameters_schema(signature, annotations) |
| 131 | module = getattr(fn, "__module__", "") |
| 132 | file_path = inspect.getsourcefile(fn) or "" |
| 133 | module_name = _derive_module_name(file_path, functions_dir) |
| 134 | return FunctionMetadata( |
| 135 | name=name, |
| 136 | description=description, |
| 137 | parameters_schema=schema, |
| 138 | module=module, |
| 139 | file_path=file_path, |
| 140 | module_name=module_name, |
| 141 | ) |
| 142 | |
| 143 | |
| 144 | def _derive_module_name(file_path: str, functions_dir: Path) -> str: |
no test coverage detected