Skip to content

Tools Reference Wiki

Akshit Sinha edited this page May 30, 2025 · 2 revisions

MCP Device Server - Tools Reference Wiki

This wiki provides comprehensive documentation for all the tools available in the MCP Device Server, including detailed parameter descriptions, usage examples, and platform-specific considerations.

Table of Contents


Camera Tools

list_cameras

Lists all cameras connected to the system.

Parameters: None

Returns:

[
  {
    "device_id": "cam0",
    "name": "Camera 0",
    "backend": "AVFOUNDATION"
  }
]

Platform Support: Windows, macOS, Linux


get_camera_info

Retrieves detailed information about a specific camera.

Parameters:

  • device_id (string, default: "cam0"): The ID of the camera to retrieve information for
    • Format: "cam" + index (e.g., "cam0", "cam1", "cam2")

Returns:

{
  "device_id": "cam0",
  "name": "Camera 0",
  "resolution": "1280x720",
  "fps": 30.0,
  "backend": "AVFOUNDATION",
  "status": "available",
  "platform": "Darwin"
}

Usage Examples:

{"device_id": "cam0"}
{"device_id": "cam1"}

capture_image

Captures a single image from a camera.

Parameters:

  • device_id (string, default: "cam0"): The ID of the camera to capture from
  • timer (integer, default: 0): Timer in seconds to wait before capturing
    • Range: 0+ seconds
    • Use 0 for immediate capture
  • save_path (string, optional): File path where the image should be saved
    • If None: Creates temporary file with timestamp
    • If directory: Creates file with timestamp in that directory
    • If full path: Uses exact path specified

Returns:

{
  "status": "success",
  "device_id": "cam0",
  "file_path": "/tmp/camera_capture_20250530_143022.jpg"
}

Usage Examples:

{"device_id": "cam0", "timer": 3}
{"device_id": "cam1", "save_path": "/Users/username/Pictures/"}
{"device_id": "cam0", "save_path": "/Users/username/Pictures/selfie.jpg"}

start_video_recording

Starts video recording from a camera.

Parameters:

  • device_id (string, default: "cam0"): The ID of the camera to record from
  • save_path (string, optional): File path where video should be saved
  • timer (integer, default: 0): Timer in seconds before starting recording
  • fps (float, default: 30.0): Frames per second for recording
    • Range: 1-30 fps (macOS limitation: max 30 fps)
    • Recommended: 15-30 fps for good quality
  • duration (integer, default: 5): Recording duration in seconds
    • Use -1 for background recording (stops with stop_video_recording)
    • Range: 1+ seconds or -1

Returns:

{
  "status": "success",
  "device_id": "cam0",
  "file_path": "/tmp/camera_recording_20250530_143022.mp4",
  "recording_status": "started",
  "resolution": "1280x720"
}

Usage Examples:

{"device_id": "cam0", "duration": 10, "fps": 24}
{"device_id": "cam1", "duration": -1, "save_path": "/Users/username/Videos/"}
{"timer": 5, "duration": 30, "fps": 15}

Requirements: FFmpeg must be installed


stop_video_recording

Stops the current background video recording.

Parameters: None

Returns:

{
  "status": "success",
  "device_id": "cam0",
  "file_path": "/tmp/camera_recording_20250530_143022.mp4",
  "duration": "45.2 seconds"
}

Printer Tools

list_printers

Lists all available printers on the system.

Parameters: None

Returns:

[
  {
    "printer_name": "HP LaserJet Pro"
  },
  {
    "printer_name": "Canon PIXMA"
  }
]

Platform Support: Windows, macOS, Linux (CUPS)


print_file

Sends a file to a printer for printing.

Parameters:

  • file_data (bytes, required): Binary data of the file to print
  • file_format (string, required): File format (e.g., "pdf", "txt", "jpg", "png")
  • printer_name (string, optional): Name of the printer to use
    • If None: Uses system default printer
  • copies (integer, default: 1): Number of copies to print
    • Range: 1+ copies
  • double_sided (boolean, default: false): Enable double-sided printing
  • color (boolean, default: false): Enable color printing
    • false: Grayscale/black and white

Returns:

{
  "success": true,
  "job_id": "printer-123-456",
  "printer": "HP LaserJet Pro"
}

Usage Examples:

{
  "file_data": "<binary_data>",
  "file_format": "pdf",
  "copies": 2,
  "double_sided": true,
  "color": true
}

print_as_pdf

Saves a PDF file to a specified location (virtual PDF printing).

Parameters:

  • file_data (bytes, required): Binary data of the PDF file
  • file_format (string, required): Must be "pdf"
  • output_path (string, required): Full path where PDF should be saved
    • If directory: Creates timestamped filename
    • If full path: Uses exact path specified

Returns:

{
  "success": true,
  "output_path": "/Users/username/Documents/document_20250530_143022.pdf"
}

get_print_job

Retrieves information about a print job.

Parameters:

  • job_id (string, required): The ID of the print job to check

Returns:

{
  "job_id": "printer-123-456",
  "printer": "HP LaserJet Pro",
  "status": "printing",
  "progress": "75.00%",
  "pages_printed": 3,
  "total_pages": 4
}

cancel_print_job

Cancels a print job.

Parameters:

  • job_id (string, required): The ID of the print job to cancel

Returns:

{
  "success": true,
  "job_id": "printer-123-456",
  "status": "cancelled"
}

Audio Tools

list_audio_devices

Lists all available audio input and output devices.

Parameters: None

Returns:

{
  "input_devices": [
    {
      "name": "Built-in Microphone",
      "max_input_channels": 1,
      "max_output_channels": 0,
      "default_sample_rate": 44100.0,
      "host_api": "Core Audio"
    }
  ],
  "output_devices": [
    {
      "name": "Built-in Speakers",
      "max_input_channels": 0,
      "max_output_channels": 2,
      "default_sample_rate": 44100.0,
      "host_api": "Core Audio"
    }
  ]
}

record_audio

Records audio from a microphone.

Parameters:

  • duration (float, default: 5.0): Recording duration in seconds
    • Use -1 for background recording (stops with stop_record_audio)
    • Range: 1+ seconds or -1
  • sample_rate (integer, default: 44100): Sample rate in Hz
    • Common values: 8000, 16000, 22050, 44100, 48000
    • Higher = better quality, larger files
  • channels (integer, default: 1): Number of audio channels
    • 1: Mono recording
    • 2: Stereo recording
  • output_file (string, optional): Path for the recorded audio file
    • If None: Creates temporary file with timestamp
  • device_index (integer, optional): Audio input device index
    • If None: Uses system default microphone
    • Get indices from list_audio_devices

Returns:

{
  "success": true,
  "output_file": "/tmp/recording_20250530_143022.wav",
  "duration": 5.0,
  "sample_rate": 44100,
  "channels": 1,
  "device_used": "Built-in Microphone"
}

Usage Examples:

{"duration": 10, "sample_rate": 48000, "channels": 2}
{"duration": -1, "output_file": "/Users/username/Music/recording.wav"}
{"device_index": 1, "duration": 30}

Requirements: PortAudio library


play_audio

Plays an audio file through speakers.

Parameters:

  • file_path (string, required): Path to the audio file to play
    • Supported format: WAV files
  • device_index (integer, optional): Audio output device index
    • If None: Uses system default speakers
    • Get indices from list_audio_devices

Returns:

{
  "success": true,
  "file_played": "/path/to/audio.wav",
  "duration": 12.5,
  "sample_rate": 44100,
  "channels": 2,
  "device_used": "Built-in Speakers",
  "status": "playing"
}

Usage Examples:

{"file_path": "/Users/username/Music/song.wav"}
{"file_path": "/tmp/recording.wav", "device_index": 0}

stop_record_audio

Stops the current background audio recording.

Parameters: None

Returns:

{
  "success": true,
  "output_file": "/tmp/recording_20250530_143022.wav",
  "duration": 45.2,
  "sample_rate": 44100,
  "channels": 1,
  "device_used": "Built-in Microphone"
}

Screen Tools

list_displays

Lists all displays connected to the system.

Parameters: None

Returns:

[
  {
    "device_id": "display0",
    "name": "Display 0",
    "resolution": "2560x1440",
    "is_primary": true,
    "x": 0,
    "y": 0
  },
  {
    "device_id": "display1",
    "name": "Display 1",
    "resolution": "1920x1080",
    "is_primary": false,
    "x": 2560,
    "y": 0
  }
]

capture_screenshot

Captures a screenshot from a display.

Parameters:

  • device_id (string, default: "display0"): Display identifier
    • Format: "display" + index (e.g., "display0", "display1")
  • save_path (string, optional): File path where screenshot should be saved
    • If None: Creates temporary file with timestamp
    • If directory: Creates file with timestamp in that directory
    • Auto-appends .png extension if none provided
  • return_image (boolean, default: false): Whether to return image data
    • true: Returns compressed image (max 512px) for viewing
    • false: Only saves to file

Returns:

{
  "success": true,
  "file_path": "/tmp/screenshot_20250530_143022.png",
  "file_size": 1024768
}

Usage Examples:

{"device_id": "display1", "return_image": true}
{"save_path": "/Users/username/Pictures/", "device_id": "display0"}
{"save_path": "/Users/username/Desktop/screenshot.png"}

record_screen

Records the screen as a video.

Parameters:

  • device_id (string, default: "0"): Display identifier for recording
    • Can be "0", "1", etc. or "display0", "display1", etc.
  • save_path (string, optional): File path where video should be saved
    • If None: Creates temporary file with timestamp
    • Auto-appends .mp4 extension if none provided
  • duration (integer, default: 3): Recording duration in seconds
    • Use -1 for background recording (stops with stop_record_screen)
    • Range: 1+ seconds or -1
  • fps (float, default: 15.0): Frames per second for recording
    • Range: 1-60 fps (recommended: 15-30 for good balance)
    • Higher fps = smoother video, larger files

Returns:

{
  "success": true,
  "file_path": "/tmp/screen_recording_20250530_143022.mp4"
}

Usage Examples:

{"device_id": "display1", "duration": 30, "fps": 24}
{"duration": -1, "fps": 30, "save_path": "/Users/username/Videos/"}
{"device_id": "0", "duration": 60, "fps": 15}

Requirements: FFmpeg must be installed


stop_record_screen

Stops the current background screen recording.

Parameters: None

Returns:

{
  "success": true,
  "file_path": "/tmp/screen_recording_20250530_143022.mp4",
  "device_id": "display0",
  "duration": "45.1 seconds",
  "file_size": 8394752
}

Platform Considerations

macOS

  • Permissions Required:
    • Camera: System Preferences → Security & Privacy → Privacy → Camera
    • Microphone: System Preferences → Security & Privacy → Privacy → Microphone
    • Screen Recording: System Preferences → Security & Privacy → Privacy → Screen Recording
  • Dependencies: Install via brew install ffmpeg portaudio

Windows

  • Camera Backend: Uses DirectShow (DSHOW) or Media Foundation (MSMF)
  • Print System: Uses Windows Management Instrumentation (WMI)
  • Dependencies: Install FFmpeg via winget install ffmpeg

Linux

  • Camera Backend: Uses Video4Linux2 (V4L2) or GStreamer
  • Print System: Uses CUPS (Common Unix Printing System)
  • Audio System: Requires ALSA or PulseAudio
  • Dependencies:
    sudo apt install ffmpeg portaudio19-dev  # Ubuntu/Debian
    sudo dnf install ffmpeg portaudio-devel  # Fedora