Skip to main content
Glama
vrppaul
by vrppaul

index_status

Check project indexing status to verify if code is searchable, see last update time, and view indexed file and chunk counts for semantic code search.

Instructions

Get the index status for a project.

Returns information about whether the project is indexed, when it was last updated, and how many files and chunks are indexed.

Note: search_code automatically re-indexes stale files before searching, so there is no need to check or act on staleness manually.

Args: project_path: Absolute path to the project root directory.

Returns: Index status including files count and chunks count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The index_status tool handler function. Registered with @mcp.tool() decorator, it validates the project_path parameter, creates an IndexService, calls get_status() to retrieve the current index status, and returns an IndexStatusResponse with is_indexed, last_updated, files_count, and chunks_count fields.
    @mcp.tool()
    @profile_async("index_status")
    async def index_status(
        project_path: str,
        ctx: Context[ServerSession, None],
    ) -> IndexStatusResponse | ErrorResponse:
        """Get the index status for a project.
    
        Returns information about whether the project is indexed, when it was last
        updated, and how many files and chunks are indexed.
    
        Note: search_code automatically re-indexes stale files before searching,
        so there is no need to check or act on staleness manually.
    
        Args:
            project_path: Absolute path to the project root directory.
    
        Returns:
            Index status including files count and chunks count.
        """
        path = Path(project_path)
        if not path.exists():
            await ctx.warning(f"Project path does not exist: {project_path}")
            return ErrorResponse(error=f"Path does not exist: {project_path}")
    
        container = get_container()
        index_service = container.create_index_service(path)
        status = index_service.get_status(path)
    
        return IndexStatusResponse(
            is_indexed=status.is_indexed,
            last_updated=status.last_updated.isoformat() if status.last_updated else None,
            files_count=status.files_count,
            chunks_count=status.chunks_count,
        )
  • Tool registration: The @mcp.tool() decorator registers the index_status function as an MCP tool with FastMCP. The profiling decorator @profile_async("index_status") tracks performance metrics.
    @mcp.tool()
    @profile_async("index_status")
  • Core implementation logic in IndexService.get_status(). This method checks if the cache directory exists, scans project files, detects stale files, retrieves indexer stats, and returns an IndexStatus domain object with is_indexed, last_updated, files_count, chunks_count, and stale_files.
    def get_status(self, project_path: Path) -> IndexStatus:
        """Get the index status for a project.
    
        Args:
            project_path: Root directory of the project.
    
        Returns:
            IndexStatus with current state information.
        """
        project_path = project_path.resolve()
        cache_dir = resolve_cache_dir(self.settings, project_path, self._cache_dir)
    
        if not cache_dir.exists():
            return IndexStatus(
                is_indexed=False,
                last_updated=None,
                files_count=0,
                chunks_count=0,
                stale_files=[],
            )
    
        cache = FileChangeCache(cache_dir)
    
        current_files = self.scan_files(project_path)
        stale_files = cache.get_stale_files(current_files)
    
        indexed_files, chunks_count = self.indexer.get_store_stats()
    
        cache_file = cache_dir / CACHE_FILENAME
        last_updated = None
        if cache_file.exists():
            last_updated = datetime.fromtimestamp(cache_file.stat().st_mtime, tz=UTC)
    
        return IndexStatus(
            is_indexed=len(indexed_files) > 0,
            last_updated=last_updated,
            files_count=len(indexed_files),
            chunks_count=chunks_count,
            stale_files=stale_files,
        )
  • API response schema: IndexStatusResponse defines the structure of the tool's output returned to the MCP client, with fields for is_indexed, last_updated (as ISO string), files_count, and chunks_count.
    class IndexStatusResponse(BaseModel):
        """Response from index_status tool."""
    
        is_indexed: bool
        last_updated: str | None
        files_count: int
        chunks_count: int
  • Domain model schema: IndexStatus is the internal domain object used within the service layer to represent index status, containing is_indexed, last_updated (datetime), files_count, chunks_count, and stale_files (list of paths).
    class IndexStatus(BaseModel):
        """Status of the index for a codebase."""
    
        is_indexed: bool
        last_updated: datetime | None
        files_count: int
        chunks_count: int
        stale_files: list[str]
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what information is returned and provides important context about automatic re-indexing behavior. However, it doesn't mention error conditions, performance characteristics, authentication requirements, or rate limits that might be relevant for a status-checking tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and efficiently organized: purpose statement, return details, important usage note, and clear parameter/return sections. Every sentence adds value, with the note about automatic re-indexing being particularly helpful without being verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (single parameter status check), the presence of an output schema (which handles return value documentation), and the comprehensive description covering purpose, usage guidance, parameter semantics, and behavioral context, this description is complete enough for the agent to understand and use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant value beyond the schema. While the schema only shows 'project_path' as a string parameter with 0% description coverage, the description clarifies it must be an 'Absolute path to the project root directory,' providing crucial semantic context that the schema lacks. With only one parameter, this is sufficient for a high score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the index status for a project' with specific details about what information is returned (indexed status, last update time, files count, chunks count). It distinguishes from siblings by focusing on status retrieval rather than indexing or searching operations. However, it doesn't explicitly contrast with siblings in the main description text.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides excellent usage guidance with the explicit note: 'search_code automatically re-indexes stale files before searching, so there is no need to check or act on staleness manually.' This clearly indicates when NOT to use this tool (for staleness checking before searching) and points to the alternative tool (search_code).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/vrppaul/semantic-code-mcp'

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