-
Notifications
You must be signed in to change notification settings - Fork 360
Description
Is your feature request related to a problem? Please describe.
Currently, the library has a list of MCP method names as constants:
Lines 1330 to 1357 in 67bd3f2
| const ( | |
| methodCallTool = "tools/call" | |
| notificationCancelled = "notifications/cancelled" | |
| methodComplete = "completion/complete" | |
| methodCreateMessage = "sampling/createMessage" | |
| methodElicit = "elicitation/create" | |
| notificationElicitationComplete = "notifications/elicitation/complete" | |
| methodGetPrompt = "prompts/get" | |
| methodInitialize = "initialize" | |
| notificationInitialized = "notifications/initialized" | |
| methodListPrompts = "prompts/list" | |
| methodListResourceTemplates = "resources/templates/list" | |
| methodListResources = "resources/list" | |
| methodListRoots = "roots/list" | |
| methodListTools = "tools/list" | |
| notificationLoggingMessage = "notifications/message" | |
| methodPing = "ping" | |
| notificationProgress = "notifications/progress" | |
| notificationPromptListChanged = "notifications/prompts/list_changed" | |
| methodReadResource = "resources/read" | |
| notificationResourceListChanged = "notifications/resources/list_changed" | |
| notificationResourceUpdated = "notifications/resources/updated" | |
| notificationRootsListChanged = "notifications/roots/list_changed" | |
| methodSetLevel = "logging/setLevel" | |
| methodSubscribe = "resources/subscribe" | |
| notificationToolListChanged = "notifications/tools/list_changed" | |
| methodUnsubscribe = "resources/unsubscribe" | |
| ) |
It would be helpful to consumers of this library if these constants could be exported so they don't need to be re-implemented.
For a concrete example, I have a telemetry middleware that handles metrics/logging for various things. In order to properly handle telemetry for, eg: tool calls vs resource calls, I use a type switch on the MCP method to do the correct things for the correct methods. Because the library doesn't export the MCP method constants, I need to reimplement the method names that I care about instrumenting:
https://github.com/tjhop/prometheus-mcp-server/blob/main/pkg/mcp/middleware.go#L12-L39
It'd be nice to defer to upstream/official constants from the library, if possible.
Describe the solution you'd like
Export the MCP method name constants so library users can use them directly.
Describe alternatives you've considered
I've already implemented a workaround, as shown. Other ideas are welcome.
Additional context