# get_site_logs

Source: https://modulify.ai/docs/mcp/code/get-site-logs

Reads the recent server logs of a site, the same stream the Logs panel shows.

- Title: Read the site server logs
- Scope: `logs:read`
- Access: Read only

Pass `preview` for the development machine that runs while someone is building, or `production` for the published site. Up to 300 lines come back newest last, each prefixed with its timestamp where the line carries one. A site with no machine running answers with a single line saying so rather than an error, so open the preview or publish first.

Nothing is stored between calls. The first call after a quiet spell returns only what is in flight at that moment, and the buffer fills toward its cap only while you keep reading, so poll across a few calls rather than expecting one to hold the history.

It answers why a site is erroring, whether an API route ran and what the server printed, so read it after a change rather than guessing from the code. Logs carry whatever the site prints, which can include values read from environment variables, and the tool tells the client never to repeat a log line anywhere it would be published. See [Logs](https://modulify.ai/docs/editor/logs).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `environment` | string | No | `preview` for the machine behind the live preview, or `production` for the published site. Defaults to `preview`, and any other value is refused before the tool runs. |