get_app_logs
Retrieve and filter application logs in real-time to monitor activity, debug issues, and analyze performance by dyno, process type, or source on Heroku MCP server applications.
Instructions
View application logs with flexible filtering options. Use this tool when you need to: 1) Monitor application activity in real-time, 2) Debug issues by viewing recent logs, 3) Filter logs by dyno, process type, or source.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | Specifies the target Heroku app whose logs to retrieve. Requirements and behaviors: 1) App must exist and be accessible to you with appropriate permissions, 2) The response includes both system events and application output, 3) Currently it's only available to Cedar generation apps. | |
| dynoName | No | Filter logs by specific dyno instance. Important behaviors: 1) Format is "process_type.instance_number" (e.g., "web.1", "worker.2"). 2) You cannot specify both dynoName and processType parameters together. Best practice: Use when debugging specific dyno behavior or performance issues. | |
| processType | No | Filter logs by process type. Key characteristics: 1) Common values: "web" (web dynos), "worker" (background workers), 2) Shows logs from all instances of the specified process type, 3) You cannot specify both dynoName and processType parameters together. Best practice: Use when debugging issues specific to web or worker processes. | |
| source | No | Filter logs by their origin. Key characteristics: 1) Common values: "app" (application logs), "heroku" (platform events), 2) When omitted, shows logs from all sources. Best practice: Use "app" for application debugging, "heroku" for platform troubleshooting. |
Implementation Reference
- src/tools/logs.ts:36-48 (handler)The async handler function that builds the Heroku logs command using CommandBuilder, executes it via herokuRepl, and processes the output with handleCliOutput.async (options: GetAppLogsOptions): Promise<McpToolResponse> => { const command = new CommandBuilder(TOOL_COMMAND_MAP.LOGS) .addFlags({ app: options.app, 'dyno-name': options.dynoName, source: options.source, 'process-type': options.processType }) .build(); const output = await herokuRepl.executeCommand(command); return handleCliOutput(output); }
- src/tools/logs.ts:13-18 (schema)Zod schema defining the input parameters for the get_app_logs tool: app (required), optional dynoName, source, processType.export const getAppGetAppLogsOptionsSchema = z.object({ app: z.string().describe('Heroku app name. Requires: permissions, Cedar-gen'), dynoName: z.string().optional().describe('Format: web.1/worker.2. Excludes processType'), source: z.string().optional().describe('app=application, heroku=platform. Default: all'), processType: z.string().optional().describe('web|worker. All instances. Excludes dynoName') });
- src/tools/logs.ts:31-50 (registration)The registerGetAppLogsTool function that registers the 'get_app_logs' tool on the MCP server with name, description, schema, and handler.export const registerGetAppLogsTool = (server: McpServer, herokuRepl: HerokuREPL): void => { server.tool( 'get_app_logs', 'App logs: monitor/debug/filter by dyno/process/source', getAppGetAppLogsOptionsSchema.shape, async (options: GetAppLogsOptions): Promise<McpToolResponse> => { const command = new CommandBuilder(TOOL_COMMAND_MAP.LOGS) .addFlags({ app: options.app, 'dyno-name': options.dynoName, source: options.source, 'process-type': options.processType }) .build(); const output = await herokuRepl.executeCommand(command); return handleCliOutput(output); } ); };
- src/index.ts:60-60 (registration)Top-level call to register the get_app_logs tool during server initialization.logs.registerGetAppLogsTool(server, herokuRepl);