Skip to main content
Glama
GongRzhe

Office Word MCP Server

get_comments_by_author

Extract comments from a Word document by a specific author to review feedback or track contributions.

Instructions

Extract comments from a specific author in a Word document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
authorYes

Implementation Reference

  • Handler and registration for the get_comments_by_author tool using @mcp.tool() decorator. Delegates execution to comment_tools module.
    @mcp.tool()
    def get_comments_by_author(filename: str, author: str):
        """Extract comments from a specific author in a Word document."""
        return comment_tools.get_comments_by_author(filename, author)
  • Core implementation logic for extracting and filtering comments by author from a Word document, using helpers from core.comments module.
    async def get_comments_by_author(filename: str, author: str) -> str:
        """
        Extract comments from a specific author in a Word document.
        
        Args:
            filename: Path to the Word document
            author: Name of the comment author to filter by
            
        Returns:
            JSON string containing filtered comments
        """
        filename = ensure_docx_extension(filename)
        
        if not os.path.exists(filename):
            return json.dumps({
                'success': False,
                'error': f'Document {filename} does not exist'
            }, indent=2)
        
        if not author or not author.strip():
            return json.dumps({
                'success': False,
                'error': 'Author name cannot be empty'
            }, indent=2)
        
        try:
            # Load the document
            doc = Document(filename)
            
            # Extract all comments
            all_comments = extract_all_comments(doc)
            
            # Filter by author
            author_comments = filter_comments_by_author(all_comments, author)
            
            # Return results
            return json.dumps({
                'success': True,
                'author': author,
                'comments': author_comments,
                'total_comments': len(author_comments)
            }, indent=2)
            
        except Exception as e:
            return json.dumps({
                'success': False,
                'error': f'Failed to extract comments: {str(e)}'
            }, indent=2)
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does ('Extract comments'), not how it behaves. It lacks details on permissions needed, error handling, output format, or whether it's read-only/destructive. This is inadequate for a tool with no annotation coverage.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part of the sentence earns its place by specifying the action, target, and context.

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

Completeness2/5

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

Given no annotations, 0% schema coverage, and no output schema, the description is incomplete. It doesn't cover parameter details, behavioral traits, or output expectations, making it insufficient for a tool with two required parameters and no structured support.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but doesn't explain the parameters. It mentions 'filename' and 'author' implicitly but provides no details on expected formats (e.g., file paths, author names) or constraints. This leaves both parameters undocumented.

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 action ('Extract comments') and target resource ('from a specific author in a Word document'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_all_comments' or 'get_comments_for_paragraph', which would require a 5.

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?

No guidance is provided on when to use this tool versus alternatives like 'get_all_comments' or 'get_comments_for_paragraph'. The description implies usage for author-specific comment extraction but offers no context about prerequisites, limitations, or comparison to siblings.

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/GongRzhe/Office-Word-MCP-Server'

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