Skip to main content
Glama
heizaheiza

Charles MCP Server

by heizaheiza

list_recordings

Retrieve saved network traffic recordings from Charles Proxy for historical analysis and debugging.

Instructions

List saved recording files using an explicit history-oriented tool name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool definition for 'list_recordings', which calls the service layer.
    @mcp.tool()
    async def list_recordings(ctx: ToolContext) -> RecordingListResult:
        """List saved recording files using an explicit history-oriented tool name."""
        deps = get_tool_dependencies(ctx)
        return deps.history_service.list_recordings_result()
  • The core logic to list recording files in the history service.
    def list_recordings(self) -> list[dict]:
        files = list_files_with_extension(self.config.package_dir, ".chlsj")
        result: list[dict] = []
        for filename in sorted(files):
            filepath = os.path.join(self.config.package_dir, filename)
            try:
                stat = os.stat(filepath)
                result.append(
                    {
                        "filename": filename,
                        "size": format_bytes(stat.st_size),
                        "size_bytes": stat.st_size,
                        "path": filepath,
                    }
                )
            except OSError:
                result.append({"filename": filename, "error": "unable_to_read_file_metadata"})
        return result
  • A wrapper method in the history service that prepares the result object for the MCP tool.
    def list_recordings_result(self) -> RecordingListResult:
        items: list[RecordingFileInfo] = []
        warnings: list[str] = []
        for record in self.list_recordings():
            if "error" in record:
                continue
            items.append(RecordingFileInfo(**record))
    
        if not items:
            warnings.append("no_saved_recordings")
    
        return RecordingListResult(
            items=items,
            total_items=len(items),
            warnings=warnings,
        )

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/heizaheiza/Charles-mcp'

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