create_roaming_task
Submit documents from public URLs to cloud print queues for pickup at any connected printer. Create remote print jobs and access files across multiple locations.
Instructions
Create a roaming print task from a public document URL.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_name | Yes | ||
| url | Yes | ||
| media_format | Yes |
Implementation Reference
- src/webprinter_mcp/server.py:55-65 (handler)MCP tool handler for create_roaming_task. Decorated with @app.tool(), it validates the media_format against SUPPORTED_MEDIA_FORMATS and delegates to the CloudPrintClient.
@app.tool() def create_roaming_task(file_name: str, url: str, media_format: str) -> dict: """Create a roaming print task from a public document URL.""" normalized = media_format.upper() if normalized not in SUPPORTED_MEDIA_FORMATS: raise ValueError(f"Unsupported media_format: {media_format}") return get_client().create_roaming_task( file_name=file_name, url=url, media_format=normalized, ) - src/webprinter_mcp/client.py:240-253 (handler)Core implementation of create_roaming_task in CloudPrintClient. Makes HTTP POST request to /openapi/task/createRoamingTask endpoint with file_name, url, and media_format.
def create_roaming_task( self, file_name: str, url: str, media_format: str, ) -> dict[str, Any]: return self._post_text( "/openapi/task/createRoamingTask", { "fileName": file_name, "url": url, "mediaFormat": media_format, }, ) - src/webprinter_mcp/server.py:55-65 (registration)Tool registration via @app.tool() decorator from FastMCP. The function signature defines the tool's input schema for the MCP framework.
@app.tool() def create_roaming_task(file_name: str, url: str, media_format: str) -> dict: """Create a roaming print task from a public document URL.""" normalized = media_format.upper() if normalized not in SUPPORTED_MEDIA_FORMATS: raise ValueError(f"Unsupported media_format: {media_format}") return get_client().create_roaming_task( file_name=file_name, url=url, media_format=normalized, ) - src/webprinter_mcp/client.py:26-45 (helper)SUPPORTED_MEDIA_FORMATS tuple defines valid media format values used for input validation in create_roaming_task and other tools.
SUPPORTED_MEDIA_FORMATS = ( "HTML", "PNG", "JPG", "PDF", "BMP", "WEBP", "WORD", "EXCEL", "PPT", "TEXT", "WPS", "ODF", "ODT", "ODS", "ODP", "ODG", "XPS", "PWG", ) - src/webprinter_mcp/client.py:99-106 (helper)_post_text helper method used by create_roaming_task to make HTTP POST requests and return the response as text (returns taskId).
def _post_text(self, endpoint: str, payload: dict[str, Any]) -> dict[str, Any]: response = self.session.post( f"{self.base_url}{endpoint}", json=payload, timeout=self.timeout, ) self._raise_for_http_error(response) return {"success": True, "taskId": response.text.strip()}