feat(env): Add terminal environment variables and termq_get MCP tool#24
Merged
Conversation
Environment Variables: - Add TERMQ_TERMINAL_ID with terminal's UUID to each session - Add TERMQ_TERMINAL_TAG_<KEY>=value for each terminal tag - Sanitize tag keys to valid env var names (uppercase, underscores) MCP Tool: - Add termq_get tool to query terminal by UUID - Designed for use with $TERMQ_TERMINAL_ID env var - Returns full terminal context including tags, llmPrompt, llmNextAction Documentation: - Add Environment Variables section to working-with-terminals.md - Add termq_get tool documentation to mcp-server.md This enables LLM agents to identify which TermQ terminal they're running in and query their current context via MCP. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The MCP configuration file enables Claude Code integration with the debug data directory. This ensures the MCP server reads from the same location as the debug build of TermQ. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The testAvailableToolsSchema test now correctly expects 9 tools after adding the termq_get tool for terminal context queries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TERMQ_TERMINAL_IDenvironment variable to each terminal session containing the terminal's UUIDTERMQ_TERMINAL_TAG_<KEY>=valueenvironment variables for each terminal tagtermq_getMCP tool to query terminal context by UUIDDetails
Environment Variables
Each TermQ terminal now has these environment variables set:
TERMQ_TERMINAL_IDTERMQ_TERMINAL_TAG_<KEY>Tag keys are sanitized: converted to uppercase, invalid characters become underscores, leading digits removed.
MCP Tool
New
termq_gettool designed for use with$TERMQ_TERMINAL_ID:Returns full terminal context including tags, llmPrompt, llmNextAction.
Test plan
🤖 Generated with Claude Code