Skip to content

feat(env): Add terminal environment variables and termq_get MCP tool#24

Merged
eyelock merged 3 commits into
mainfrom
feature/terminal-env-and-mcp-context
Jan 14, 2026
Merged

feat(env): Add terminal environment variables and termq_get MCP tool#24
eyelock merged 3 commits into
mainfrom
feature/terminal-env-and-mcp-context

Conversation

@eyelock
Copy link
Copy Markdown
Owner

@eyelock eyelock commented Jan 13, 2026

Summary

  • Add TERMQ_TERMINAL_ID environment variable to each terminal session containing the terminal's UUID
  • Add TERMQ_TERMINAL_TAG_<KEY>=value environment variables for each terminal tag
  • Add termq_get MCP tool to query terminal context by UUID

Details

Environment Variables

Each TermQ terminal now has these environment variables set:

Variable Description
TERMQ_TERMINAL_ID UUID of the current terminal
TERMQ_TERMINAL_TAG_<KEY> One variable per tag (sanitized key)

Tag keys are sanitized: converted to uppercase, invalid characters become underscores, leading digits removed.

MCP Tool

New termq_get tool designed for use with $TERMQ_TERMINAL_ID:

# Get current terminal's context
termq_get id="$TERMQ_TERMINAL_ID"

Returns full terminal context including tags, llmPrompt, llmNextAction.

Test plan

  • Create terminal with tags, verify env vars are set correctly
  • Test tag key sanitization (spaces, dashes, special chars)
  • Test termq_get MCP tool returns correct terminal data
  • Verify documentation is accurate

🤖 Generated with Claude Code

David Collie and others added 3 commits January 13, 2026 23:28
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>
@eyelock eyelock merged commit 174c5e9 into main Jan 14, 2026
5 checks passed
@eyelock eyelock deleted the feature/terminal-env-and-mcp-context branch January 14, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant