Claude Corner
Hook or MCP Server Misbehaving in Claude Code? Run /debug and Let Claude Read the Log.
By Steven Sorensen ยท 30 Nov 2026

At a glance
- One built in command turns on logging in your session and has Claude read the log.
- A short description focuses the analysis.
- Launch flags catch problems at startup and can write the log to a file you choose.
A hook that used to finish instantly now drags every edit, or a connected MCP server offers no tools. Turn logging on where you are and ask Claude to read it.
Why it matters
Anthropic's commands reference says debug logging is off by default unless you started with claude --debug, and that /debug turns it on for the current session and troubleshoots by reading the session debug log. The configuration guide adds that it prompts Claude to diagnose from the log and settings paths. The same reference puts /doctor on installation and configuration issues and /debug on runtime issues.
How to let Claude read the debug log
These steps come from Anthropic's docs. We have not run them in a live session.
- Run
/debugplus a short description, such as/debug the format hook seems slow after each edit. The commands reference says the description is optional and focuses the analysis. - Then try the action that went wrong again, so later log lines can include it. This is our suggestion, not a documented step. The reference says running
/debugpartway through a session captures logs from that point forward. - If the problem happens at startup, exit and launch with a category filter, such as
claude --debug=mcp. The CLI reference says the filter only binds in the equals form. A filter after a space turns on debug mode without filtering. - To keep the log in a known place, launch with
claude --debug-fileand a path. The CLI reference says this writes the log there and turns on debug mode by itself. - To read the log yourself, open
~/.claude/debug/in a file named after the session ID. The hooks guide says--debugdoes not print to the terminal. - For a slow hook, search for
Hooks:lines. On v2.1.296 or later, the hooks guide says each one names the event, the command, how the run ended and how long it took.
# We have not run this script end to end on every platform.
# Inside a session
/debug the format hook seems slow after each edit
# MCP activity from launch
claude --debug=mcp
# Chosen log file
claude --debug-file /tmp/claude-debug.log
# Default log folder
ls ~/.claude/debug/
Gotchas
- It only sees what happens next. Logging starts when you run the command, so an earlier error needs a repeat or a fresh launch with
--debug. - Mind the equals sign.
claude --debug=mcpfilters to MCP. With a space instead, the CLI reference says you get debug mode with no filter. - Logs stay on disk. The
.claudedirectory guide saysdebug/holds per session logs, andclaude purgedeletes them along with that project's transcripts and auto memory, so preview with--dry-runfirst. - It is a skill, not fixed logic. The skills guide says bundled skills like
/debugare prompt based, giving Claude instructions and letting it work with its tools, while most built in commands run fixed logic.
If the trouble started right after a setup change, test it with customizations off first using Claude Code Acting Strange After a Setup Change? Start It in Safe Mode.
Sources:
- Commands
- Debug your configuration
- CLI reference
- Hooks reference
- Explore the .claude directory
- Extend Claude with skills
Recommended AI prompt
Copy this paragraph into ChatGPT, Claude, Gemini, Grok, or whatever AI you use.
I use Claude Code and something misbehaves partway through a session, such as a slow hook or an MCP server with no tools. Using only Anthropic's Claude Code docs for /debug and the debug flags, ask me what the symptom is and when it first appears. Then give me a short plan: whether to run /debug now or restart with a filtered debug flag, which action to repeat so the log captures it, where the log file is, and how to check it before I change any settings.