Skip to content

fix: Truncate if the servername + toolname are too long #1455

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 1 commit into from
May 30, 2025

Conversation

Randall-Jiang
Copy link
Contributor

@Randall-Jiang Randall-Jiang commented May 28, 2025

Problem

There is a hard limit for toolName+servername on bedrock.

Solution

Add truncation logic. To make it unique and less than required length.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Randall-Jiang Randall-Jiang requested a review from a team as a code owner May 28, 2025 04:45
@Randall-Jiang Randall-Jiang force-pushed the truncate branch 2 times, most recently from 20cb14a to 1aa60b5 Compare May 28, 2025 18:04
@Randall-Jiang Randall-Jiang changed the title Truncate fix: Truncate if the servername + toolname are too long May 28, 2025
Copy link
Contributor

@bywang56 bywang56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are other places that we still concatenate and split using '' or '__', can you please do a global search and fix all these places based on your change?

// If truncation resulted in a conflict, fall through to suffix strategy
}
}
// Use tool name with numeric suffix (no server prefix)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work when we retrieving the server name and tool name from toolspec right? like the places Na changed in her PR: https://github.com/aws/language-servers/pull/1451/files#diff-0da876fbe798d89b1ae25052ceca6949c8b334ed02f207f1f5c45b3d5dbeebf0

@@ -2717,8 +2733,11 @@ export class AgenticChatController implements ChatHandlers {
// Read Only Tools = All Tools - Restricted Tools (MCP + Write Tools)
// TODO: mcp tool spec name will be server___tool.
// TODO: Will also need to handle rare edge cases of long server name + long tool name > 64 char
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove the todos if not applicable

@Randall-Jiang Randall-Jiang merged commit 3cdbd36 into aws:agentic-mcp May 30, 2025
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.

3 participants