feat(mcp): return logs as pre-formatted strings to reduce token usage#145
Merged
feat(mcp): return logs as pre-formatted strings to reduce token usage#145
Conversation
b1251d3 to
5140009
Compare
nathanjcochran
approved these changes
Apr 9, 2026
Member
nathanjcochran
left a comment
There was a problem hiding this comment.
LGTM! Thanks for making this change!
internal/tiger/mcp/service_tools.go
Outdated
| Message: e.Message, | ||
| Severity: e.Severity, | ||
| if !e.Timestamp.IsZero() { | ||
| logs[i] = e.Timestamp.UTC().Format(time.RFC3339) + " " + e.Message |
Member
There was a problem hiding this comment.
Why are we using a different timestamp format here compared to in the CLI command and API? Shouldn't we use the same format everywhere, for consistency?
Contributor
Author
There was a problem hiding this comment.
Just Claude doing it wrong.
I changed it but made the CLI use local timezone I think that's better in that case?
Let me know if you disagree though and we can change it to UTC too
nathanjcochran
approved these changes
Apr 10, 2026
Replace the structured entries array (objects with timestamp, message, severity fields) with a flat []string where each line is prefixed with an RFC3339 timestamp. The message already contains the severity so there is no information loss, and the token count per log entry drops significantly.
Use "2006-01-02 15:04:05 UTC" (matching PostgreSQL log format) instead of RFC3339 in MCP output. CLI text output renders in local timezone so users see timestamps in their own timezone; MCP and the public API use UTC.
d3582fa to
31bad04
Compare
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
Improves on the structured log entries introduced in #143. That PR returned an
entriesarray of JSON objects, each withtimestamp,message, andseverityfields. This PR replaces that with a flatlogs []stringwhere each line is an RFC3339 timestamp prepended to the log message.The severity is already embedded in the message text so there is no information loss, but the token count per MCP tool call drops significantly — a JSON object with three named fields per entry becomes a single string.