Binary Reader MCP defines 2 tools with complete input schemas and basic descriptions. However, definitions fall short of production quality in several critical areas. Tool names lack strong action verbs and descriptions are generic without guidance on when to use each tool or what prevents tool selection. Parameter descriptions are minimal (file_path is described as 'Path to the .uasset file', tautological). Output schemas are undocumented, LLMs have no formal spec for what fields to expect in responses. Error handling returns plain text strings with no recovery guidance. The codebase shows context manager patterns and basic file I/O, but no evidence of input sanitization, permission checks, or audit logging. Overall, this is a competent but minimal implementation that would struggle in agent-heavy workflows.
Tool names lack strong action verbs. 'read-unreal-asset' and 'read-binary-metadata' are weak; 'get_*' or 'analyze_*' would be clearer. Current names do not clearly convey intent for LLM tool selection.
Descriptions are too generic and lack actionable context. 'Read and analyze Unreal Engine .uasset file structure' does not explain WHEN to use this tool vs. read-binary-metadata, what the output contains, or what prerequisites exist. LLMs cannot distinguish tool selection criteria from these descriptions.
Output schemas are not documented. The code returns TextContent with formatted strings (e.g., 'Header Information:\nMagic: ...'), but LLMs have no formal schema describing what fields are present, their types, or their meaning. Agents cannot reliably extract or chain results.
read-unreal-assetread-binary-metadata
Recommendations
Rename tools to stronger action verbs: 'read-unreal-asset' → 'analyze_unreal_asset' or 'get_unreal_asset_structure'; 'read-binary-metadata' → 'analyze_binary_file' or 'extract_binary_metadata'. Ensure the name alone conveys the action.
Expand tool descriptions to 100 - 200 characters each. For read-unreal-asset: 'Parses and analyzes Unreal Engine .uasset binary files. Returns header magic, version, file size, and metadata flags. Use this to inspect Unreal asset structure; for generic binary files, use analyze_binary_file instead.' For read-binary-metadata: 'Extracts metadata from binary files. Auto-detects Unreal assets; supports explicit format override. Returns file size, header info, and structure. Use for binary file forensics or when format is unknown.'
Document output schemas formally. Add a 'returns' section to tool descriptions or a separate schema object: 'Returns object with fields: file_size (integer, bytes), header (object with magic, version, file_size), metadata (object with flags, element_count, bulk_data_size), format (string: 'unreal' or 'generic'). All fields are nullable if parsing fails.'
Add detailed parameter descriptions. 'file_path': 'Absolute or relative path to the binary file. Must exist and be readable by the agent. Path traversal (../) is not allowed for security. Max length 4096 characters.' For format: 'One of: auto (attempt to detect format from extension and magic bytes), unreal (force Unreal .uasset parser), custom (reserved for future use). Defaults to auto.'
Parameter descriptions are tautological and lack constraints. 'file_path': 'Path to the .uasset file' restates the parameter name without explaining format, range, or examples. No mention of whether paths must be absolute, relative, or if symlinks are followed. No validation rules documented.
Error handling provides no recovery guidance. Errors like 'Error: File not found - {file_path}' or 'Unexpected error: {str(e)}' give agents no actionable next step. Per pattern:recovery-guide, errors should suggest alternatives (e.g., 'File not found. Check the path or list available files with...').
No input validation or sanitization visible. The code does not validate file paths against directory traversal (../../etc/passwd), symlink attacks, or permission checks before opening files. Agents could be tricked into reading sensitive files outside intended scope.
No tool annotations present. Tools do not declare readOnlyHint (both tools are read-only), idempotentHint (both are idempotent), or any destructiveHint. These annotations help agents reason about side effects and retry logic.
No audit logging or permission checks present. Code does not log who called the tool, when, or with which parameters. No verification that the calling user/agent has read permission on the target file. Compliance and debugging will be difficult.
Format parameter in read-binary-metadata has vague enum values. 'auto', 'unreal', 'custom' are acceptable, but no description explains what 'custom' does, when 'auto' might fail, or how the tool chooses between formats. 'custom' especially needs documentation of what it expects.
read-binary-metadata
Implement input validation: check file_path for directory traversal, verify file exists and is readable, reject paths exceeding 4096 chars, enforce a whitelist of allowed directories if possible. Return actionable errors: 'File not found at /path/to/file. Check the path exists and is readable. Available directories: /data/assets, /tmp/uploads.'
Add tool annotations to the schema. For both tools, add 'readOnlyHint': true, 'idempotentHint': true to signal they are safe to retry and have no side effects.
Implement audit logging. Log each tool call to stderr or a dedicated logger: '{"timestamp": "2025-01-15T10:30:00Z", "tool": "analyze_unreal_asset", "file_path": "<sanitized>", "caller": "agent-id", "status": "success|error", "duration_ms": 45}'.
Enhance error handling with recovery hints. FileNotFoundError → 'File not found at {path}. Verify the path exists and is readable. Call list_available_files() to browse the directory.' For parse errors: 'Failed to parse as Unreal asset: {reason}. Verify the file is a valid .uasset. Try analyze_binary_file with format=auto or format=custom.'
Add a 'format' description clarifying what 'custom' means or deprecate it. If it's a placeholder, note: 'custom: Reserved for future use. Currently unsupported.' If it has a definition, document the expected structure.
Document when each tool should be used vs. the other. In read-unreal-asset description, add: 'Use this for .uasset files to extract Unreal-specific metadata. For other binary formats, use read-binary-metadata instead.' In read-binary-metadata, add: 'Use this for generic binary files or when format is unknown. For Unreal assets specifically, read-unreal-asset is more accurate.'