get_default_printer
Retrieve the name of the default printer configured in the system's CUPS printing system to enable document printing operations.
Instructions
Get the name of the default printer
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/printer.ts:137-148 (handler)The handler function for the 'get_default_printer' tool. It executes the 'lpstat -d' command using execCommand, parses the output to extract the default printer name, and returns a structured text response.async () => { const output = await execCommand("lpstat", ["-d"]) const defaultPrinter = output.split(": ")[1] || "No default printer set" return { content: [ { type: "text", text: `Default printer: ${defaultPrinter}`, }, ], } }
- src/tools/printer.ts:129-149 (registration)Registers the 'get_default_printer' tool with the MCP server, including a descriptive comment, metadata (title, description), empty input schema, and inline handler implementation.// get_default_printer - Get the default printer server.registerTool( "get_default_printer", { title: "Get Default Printer", description: "Get the name of the default printer", inputSchema: {}, }, async () => { const output = await execCommand("lpstat", ["-d"]) const defaultPrinter = output.split(": ")[1] || "No default printer set" return { content: [ { type: "text", text: `Default printer: ${defaultPrinter}`, }, ], } } )
- src/tools/printer.ts:132-136 (schema)The schema definition for the 'get_default_printer' tool, specifying title, description, and empty input schema (no parameters required).{ title: "Get Default Printer", description: "Get the name of the default printer", inputSchema: {}, },