-
-
Notifications
You must be signed in to change notification settings - Fork 558
Add tool call history #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { toolHistory } from '../utils/toolHistory.js'; | ||
| import { GetRecentToolCallsArgsSchema } from '../tools/schemas.js'; | ||
| import { ServerResult } from '../types.js'; | ||
|
|
||
| /** | ||
| * Handle get_recent_tool_calls command | ||
| */ | ||
| export async function handleGetRecentToolCalls(args: unknown): Promise<ServerResult> { | ||
| try { | ||
| const parsed = GetRecentToolCallsArgsSchema.parse(args); | ||
|
|
||
| // Use formatted version with local timezone | ||
| const calls = toolHistory.getRecentCallsFormatted({ | ||
| maxResults: parsed.maxResults, | ||
| toolName: parsed.toolName, | ||
| since: parsed.since | ||
| }); | ||
|
|
||
| const stats = toolHistory.getStats(); | ||
|
|
||
| // Format the response (excluding file path per user request) | ||
| const summary = `Tool Call History (${calls.length} results, ${stats.totalEntries} total in memory)`; | ||
| const historyJson = JSON.stringify(calls, null, 2); | ||
|
|
||
| return { | ||
| content: [{ | ||
| type: "text", | ||
| text: `${summary}\n\n${historyJson}` | ||
| }] | ||
| }; | ||
| } catch (error) { | ||
| return { | ||
| content: [{ | ||
| type: "text", | ||
| text: `Error getting tool history: ${error instanceof Error ? error.message : String(error)}` | ||
| }], | ||
| isError: true | ||
| }; | ||
| } | ||
| } |
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the documentation about history persistence.
Line 828 states "History kept in memory (last 1000 calls, lost on restart)", but according to
src/utils/toolHistory.ts, history is actually persisted to disk in~/.claude-server-commander/tool-history.jsonland reloaded on startup. Only the in-memory cache is limited to 1000 entries, but the full history survives restarts.Apply this diff to correct the documentation:
description: ` Get recent tool call history with their arguments and outputs. Returns chronological list of tool calls made during this session. Useful for: - Onboarding new chats about work already done - Recovering context after chat history loss - Debugging tool call sequences Note: Does not track its own calls or other meta/query tools. - History kept in memory (last 1000 calls, lost on restart). + History persisted to disk and survives restarts (last 1000 calls kept in memory). ${CMD_PREFIX_DESCRIPTION}`,📝 Committable suggestion
🤖 Prompt for AI Agents