mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
💻 refactor: Migrate MCP UI resources from index-based to ID-based referencing
- Replace index-based resource markers with stable resource IDs
- Update plugin to parse \ui{resourceId} format instead of \ui0
- Refactor components to use useMessagesOperations instead of useSubmitMessage
- Add ShareMessagesProvider for UI resources in share view
- Add useConversationUIResources hook for cross-turn resource lookups
- Update parsers to generate resource IDs from content hashes
- Update all tests to use resource IDs instead of indices
- Add sandbox permissions for iframe popups
- Remove deprecated MCP tool context instructions
This commit is contained in:
parent
08103ffb22
commit
649036903f
20 changed files with 636 additions and 599 deletions
|
|
@ -335,15 +335,6 @@ Current Date & Time: ${replaceSpecialVars({ text: '{{iso_datetime}}' })}
|
|||
};
|
||||
continue;
|
||||
} else if (tool && mcpToolPattern.test(tool)) {
|
||||
toolContextMap[tool] = `# MCP Tool \`${tool}\`:
|
||||
When this tool returns UI resources (URIs starting with "ui://"):
|
||||
- You should usually introduce what you're showing before the marker
|
||||
- For a single resource: \\ui0
|
||||
- For multiple resources shown separately: \\ui0 \\ui1
|
||||
- For multiple resources in a carousel: \\ui0,1,2
|
||||
- The UI will be rendered inline where you place the marker
|
||||
- Format: \\ui{index} or \\ui{index1,index2,index3} where indices are 0-based, in the order they appear in the tool response`;
|
||||
|
||||
const [toolName, serverName] = tool.split(Constants.mcp_delimiter);
|
||||
if (toolName === Constants.mcp_server) {
|
||||
/** Placeholder used for UI purposes */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue