Skip to content

Introduced utility methods to check if a tool, resource, or prompt is registered #568

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trknhr
Copy link

@trknhr trknhr commented May 30, 2025

Summary

Add utility methods and corresponding tests to check registration status of tools, resources, and prompts in McpServer.

Motivation and Context

Previously, there was no way to introspect whether a specific tool, resource, or prompt was registered in the server.
This change introduces hasTool, hasResource, and hasPrompt methods to fill that gap, improving reliability and debuggability for consumers and test cases.

How Has This Been Tested?

  • Unit tests were added under a new describe("registration checks", ...) block in mcp.test.ts.
  • Verified that the server correctly returns true or false depending on whether the name/URI is registered.

Breaking Changes

None. This is a non-breaking addition of utility methods.

Types of changes

  • New feature (non-breaking change which adds functionality)

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
  • I have added or updated documentation as needed

Additional context

These methods may be useful for tooling or plugin systems that want to conditionally register behavior or inspect the server's current state without risking overwrites or duplication.

…n McpServer

- Introduced utility methods to check if a tool, resource, or prompt is registered
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.

1 participant