view
Retrieve email content from file paths using the mu mail indexer. Display message bodies, headers, and attachments by providing paths from mu search queries.
Instructions
View emails using mu, by providing their paths.
mu view $pathsPaths can be extracted using the following:
mu find --fields "l" SOME_QUERYInput Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paths | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- mu_mcp/mu_mcp.py:48-68 (handler)The main handler function for the 'view' tool. Takes paths as input, runs 'mu view' subprocess command, and returns the email content or error message.
def view(paths: str) -> str: """View emails using `mu`, by providing their paths. ``` mu view $paths ``` Paths can be extracted using the following: ``` mu find --fields "l" SOME_QUERY ``` """ import subprocess try: result = subprocess.run( ["mu", "view"] + paths.split(), capture_output=True, text=True, check=True ) return result.stdout.strip() except subprocess.CalledProcessError as e: return f"Error: {e.stderr.strip()}" - mu_mcp/mu_mcp.py:47-59 (schema)The function signature and docstring define the input schema (paths: str) and output schema (str). The docstring documents the tool's purpose, usage syntax, and how to obtain paths for the tool.
@mcp.tool("view") def view(paths: str) -> str: """View emails using `mu`, by providing their paths. ``` mu view $paths ``` Paths can be extracted using the following: ``` mu find --fields "l" SOME_QUERY ``` """ - mu_mcp/mu_mcp.py:47-47 (registration)The @mcp.tool("view") decorator registers the view function as an MCP tool named 'view' with the FastMCP server.
@mcp.tool("view")