Skip to main content
Glama
hyunjae-labs

xlwings Excel MCP Server

list_workbooks

Retrieve information about all currently open Excel workbooks to monitor active sessions and manage workbook operations through the xlwings Excel MCP Server.

Instructions

List all open workbook sessions.

Returns:
    List of session information dictionaries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler and registration for the 'list_workbooks' tool using @mcp.tool() decorator. Delegates to SESSION_MANAGER.list_sessions() to return list of active sessions.
    @mcp.tool()
    def list_workbooks() -> List[Dict[str, Any]]:
        """
        List all open workbook sessions.
        
        Returns:
            List of session information dictionaries
        """
        try:
            return SESSION_MANAGER.list_sessions()
        except Exception as e:
            logger.error(f"Error listing workbooks: {e}")
            raise WorkbookError(f"Failed to list workbooks: {str(e)}")
  • ExcelSessionManager.list_sessions(): Core logic that iterates over active sessions and calls get_info() on each to build the response list.
    def list_sessions(self) -> list:
        """List all active sessions"""
        with self._sessions_lock:
            return [session.get_info() for session in self._sessions.values()]
  • ExcelSession.get_info(): Provides the detailed information dictionary for each session, including ID, path, visibility, timestamps, and list of sheets.
    def get_info(self) -> Dict[str, Any]:
        """Get session information"""
        return {
            "session_id": self.id,
            "filepath": self.filepath,
            "visible": self.visible,
            "read_only": self.read_only,
            "created_at": datetime.fromtimestamp(self.created_at).isoformat(),
            "last_access": datetime.fromtimestamp(self.last_accessed).isoformat(),
            "sheets": [sheet.name for sheet in self.workbook.sheets] if self.workbook else []
        }
  • Tool registration via FastMCP @mcp.tool() decorator with inferred schema from type hints (no parameters, returns List[Dict[str, Any]]).
    @mcp.tool()
    def list_workbooks() -> List[Dict[str, Any]]:
        """
        List all open workbook sessions.
        
        Returns:
            List of session information dictionaries
        """
        try:
            return SESSION_MANAGER.list_sessions()
        except Exception as e:
            logger.error(f"Error listing workbooks: {e}")
            raise WorkbookError(f"Failed to list workbooks: {str(e)}")
Behavior2/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 mentions the return type ('List of session information dictionaries') but lacks details on what information is included (e.g., session IDs, timestamps, user data), whether it's read-only or has side effects, or any limitations like rate limits. This leaves significant gaps for a tool that interacts with workbook sessions.

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 extremely concise and front-loaded, with two brief sentences that directly state the action and return value. There is no wasted text, making it efficient and easy to parse for an AI agent.

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

Completeness3/5

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

Given the tool has 0 parameters, 100% schema coverage, and an output schema exists, the description is minimally adequate. However, it lacks context on behavioral aspects like what constitutes an 'open workbook session' or how the list is formatted, which could be helpful despite the structured data. This makes it just sufficient but not comprehensive.

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 input schema has 0 parameters with 100% coverage, so no parameter information is needed in the description. The description correctly avoids discussing parameters, which is appropriate, but doesn't add any extra context about optional filters or scoping, so it's not a perfect 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 verb ('List') and resource ('all open workbook sessions'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_workbook_metadata' or 'open_workbook', which could also provide session-related information, so it falls short of a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. For example, it doesn't clarify if this should be used for checking active sessions before opening a workbook or as a general status check, leaving the agent to infer usage from context alone.

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/hyunjae-labs/xlwings-mcp-server'

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