Skip to main content
Glama

lc_missing

Retrieve missing context like files, implementations, or excluded sections to complete code understanding and analysis.

Instructions

Unified tool for retrieving missing context (files, implementations, or excluded sections). Args: root_path: Root directory path (e.g. '/home/user/projects/myproject') param_type: Type of data - 'f' for files, 'i' for implementations, 'e' for excluded sections data: JSON string containing the data (file paths in /{project-name}/ format or implementation queries) timestamp: Context generation timestamp

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
root_pathYes
param_typeYes
dataYes
timestampYes

Implementation Reference

  • The handler function for the lc_missing MCP tool, including registration via @mcp.tool() decorator and docstring schema. Dispatches to helpers based on param_type.
    @mcp.tool()
    def lc_missing(root_path: str, param_type: str, data: str, timestamp: float) -> str:
        """Unified tool for retrieving missing context (files, implementations, or excluded sections).
        Args:
            root_path: Root directory path (e.g. '/home/user/projects/myproject')
            param_type: Type of data - 'f' for files, 'i' for implementations, 'e' for excluded sections
            data: JSON string containing the data (file paths in /{project-name}/ format or implementation queries)
            timestamp: Context generation timestamp
        """
        env = ExecutionEnvironment.create(Path(root_path))
        with env.activate():
            if param_type == "f":
                file_list = ast.literal_eval(data)
                return commands.get_missing_files(env, file_list, timestamp)
            elif param_type == "i":
                impl_list = ast.literal_eval(data)
                return commands.get_implementations(env, impl_list)
            elif param_type == "e":
                file_list = ast.literal_eval(data)
                return commands.get_excluded(env, file_list, timestamp)
            else:
                raise ValueError(
                    f"Invalid parameter type: {param_type}. Use 'f' for files, 'i' for implementations, or 'e' for excluded sections."
                )
  • Helper function for retrieving missing files (param_type='f') used by lc_missing handler.
    def get_missing_files(env: ExecutionEnvironment, paths: list[str], timestamp: float) -> str:
        PathConverter.create(env.config.project_root_path).validate_with_error(paths)
        matching_selection = env.state.selections.get_selection_by_timestamp(timestamp)
        if matching_selection is None:
            raise ValueError(
                f"No context found with timestamp {timestamp}. Warn the user that the context is stale."
            )
        settings = ContextSettings.create(False, False, True, False)
        generator = ContextGenerator.create(env.config, env.state.file_selection, settings, env.tagger)
        return generator.missing_files(paths, matching_selection, timestamp)
  • Helper function for retrieving excluded sections (param_type='e') used by lc_missing handler.
    def get_excluded(env: ExecutionEnvironment, paths: list[str], timestamp: float) -> str:
        PathConverter.create(env.config.project_root_path).validate_with_error(paths)
        matching_selection = env.state.selections.get_selection_by_timestamp(timestamp)
        if matching_selection is None:
            raise ValueError(f"No context found with timestamp {timestamp}...")
        settings = ContextSettings.create(False, False, True, False)
        generator = ContextGenerator.create(env.config, env.state.file_selection, settings, env.tagger)
        return generator.excluded(paths, matching_selection, timestamp)
  • Helper function for retrieving implementations/definitions (param_type='i') used by lc_missing handler.
    def get_implementations(env: ExecutionEnvironment, queries: list[tuple[str, str]]) -> str:
        PathConverter.create(env.config.project_root_path).validate_with_error([p for p, _ in queries])
        settings = ContextSettings.create(False, False, True, False)
        return ContextGenerator.create(
            env.config, env.state.file_selection, settings, env.tagger
        ).definitions(queries)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyberchitta/llm-context.py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server