Skip to content

Conversation

alex210501
Copy link

@alex210501 alex210501 commented Jul 30, 2025

Add the possibility to copy the input parameters of a tool to the clipboard.

Implement the useCopy() hook, handling the state variable copied, and put it back to false after a timeout

Motivation and Context

Copy the input parameters to the clipboard allows to create reproductible scenarios such as:

  • Copy input parameters into a files and reproduce it later
  • Adding those input parameters in a PR to make the output reproductible

Note: Those are scenarios where I needed to copy paste the values of each tool one by one

How Has This Been Tested?

Tested by running npm test and npm run test:e2e

Screen.Recording.2025-07-31.at.00.50.26.mov

Breaking Changes

NA

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • [NA] I have added or updated documentation as needed

Additional context

@alex210501 alex210501 changed the title refactor: Add useCopy() feat: Copy the tool input parameters Jul 30, 2025
The `useCopy()` hook is pretty simple, as it handle a state variable
(`copied`) and put it back to false after a `timeout`
@alex210501 alex210501 force-pushed the alejandro.borbolla/copy-input branch from c824c6e to 5bbd9f7 Compare July 31, 2025 15:41
@olaservo olaservo added the tools Issues related to testing tools label Aug 3, 2025
@alex210501
Copy link
Author

Hi @olaservo, do you think I could get a review on this PR please 🥺🙏

Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

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

Hi @alex210501 , thanks for your patience. I left a minor comment about the error message, plus it looks like there is a CI failure related to an unused variable: https://github.com/modelcontextprotocol/inspector/actions/runs/17366912666/job/49331834386?pr=662

} catch (error) {
toast({
title: "Error",
description: `There was an error coping result into the clipboard: ${error instanceof Error ? error.message : String(error)}`,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description: `There was an error coping result into the clipboard: ${error instanceof Error ? error.message : String(error)}`,
description: `There was an error copying input to the clipboard: ${error instanceof Error ? error.message : String(error)}`,

Copy link
Author

Choose a reason for hiding this comment

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

Done in 16e0077

@olaservo olaservo added the waiting on submitter Waiting for the submitter to provide more info label Sep 1, 2025
@alex210501 alex210501 requested a review from olaservo September 1, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Issues related to testing tools waiting on submitter Waiting for the submitter to provide more info
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants