|
| 1 | +# Copyright The OpenTelemetry Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +from enum import Enum |
| 16 | +from typing import Final |
| 17 | + |
| 18 | +MCP_METHOD_NAME: Final = "mcp.method.name" |
| 19 | +""" |
| 20 | +The name of the request or notification method. |
| 21 | +""" |
| 22 | + |
| 23 | +MCP_PROTOCOL_VERSION: Final = "mcp.protocol.version" |
| 24 | +""" |
| 25 | +The [version](https://modelcontextprotocol.io/specification/versioning) of the Model Context Protocol used. |
| 26 | +""" |
| 27 | + |
| 28 | +MCP_RESOURCE_URI: Final = "mcp.resource.uri" |
| 29 | +""" |
| 30 | +The value of the resource uri. |
| 31 | +Note: This is a URI of the resource provided in the following requests or notifications: `resources/read`, `resources/subscribe`, `resources/unsubscribe`, or `notifications/resources/updated`. |
| 32 | +""" |
| 33 | + |
| 34 | +MCP_SESSION_ID: Final = "mcp.session.id" |
| 35 | +""" |
| 36 | +Identifies [MCP session](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management). |
| 37 | +""" |
| 38 | + |
| 39 | + |
| 40 | +class McpMethodNameValues(Enum): |
| 41 | + NOTIFICATIONS_CANCELLED = "notifications/cancelled" |
| 42 | + """Notification cancelling a previously-issued request.""" |
| 43 | + INITIALIZE = "initialize" |
| 44 | + """Request to initialize the MCP client.""" |
| 45 | + NOTIFICATIONS_INITIALIZED = "notifications/initialized" |
| 46 | + """Notification indicating that the MCP client has been initialized.""" |
| 47 | + NOTIFICATIONS_PROGRESS = "notifications/progress" |
| 48 | + """Notification indicating the progress for a long-running operation.""" |
| 49 | + PING = "ping" |
| 50 | + """Request to check that the other party is still alive.""" |
| 51 | + RESOURCES_LIST = "resources/list" |
| 52 | + """Request to list resources available on server.""" |
| 53 | + RESOURCES_TEMPLATES_LIST = "resources/templates/list" |
| 54 | + """Request to list resource templates available on server.""" |
| 55 | + RESOURCES_READ = "resources/read" |
| 56 | + """Request to read a resource.""" |
| 57 | + NOTIFICATIONS_RESOURCES_LIST_CHANGED = ( |
| 58 | + "notifications/resources/list_changed" |
| 59 | + ) |
| 60 | + """Notification indicating that the list of resources has changed.""" |
| 61 | + RESOURCES_SUBSCRIBE = "resources/subscribe" |
| 62 | + """Request to subscribe to a resource.""" |
| 63 | + RESOURCES_UNSUBSCRIBE = "resources/unsubscribe" |
| 64 | + """Request to unsubscribe from resource updates.""" |
| 65 | + NOTIFICATIONS_RESOURCES_UPDATED = "notifications/resources/updated" |
| 66 | + """Notification indicating that a resource has been updated.""" |
| 67 | + PROMPTS_LIST = "prompts/list" |
| 68 | + """Request to list prompts available on server.""" |
| 69 | + PROMPTS_GET = "prompts/get" |
| 70 | + """Request to get a prompt.""" |
| 71 | + NOTIFICATIONS_PROMPTS_LIST_CHANGED = "notifications/prompts/list_changed" |
| 72 | + """Notification indicating that the list of prompts has changed.""" |
| 73 | + TOOLS_LIST = "tools/list" |
| 74 | + """Request to list tools available on server.""" |
| 75 | + TOOLS_CALL = "tools/call" |
| 76 | + """Request to call a tool.""" |
| 77 | + NOTIFICATIONS_TOOLS_LIST_CHANGED = "notifications/tools/list_changed" |
| 78 | + """Notification indicating that the list of tools has changed.""" |
| 79 | + LOGGING_SET_LEVEL = "logging/setLevel" |
| 80 | + """Request to set the logging level.""" |
| 81 | + NOTIFICATIONS_MESSAGE = "notifications/message" |
| 82 | + """Notification indicating that a message has been received.""" |
| 83 | + SAMPLING_CREATE_MESSAGE = "sampling/createMessage" |
| 84 | + """Request to create a sampling message.""" |
| 85 | + COMPLETION_COMPLETE = "completion/complete" |
| 86 | + """Request to complete a prompt.""" |
| 87 | + ROOTS_LIST = "roots/list" |
| 88 | + """Request to list roots available on server.""" |
| 89 | + NOTIFICATIONS_ROOTS_LIST_CHANGED = "notifications/roots/list_changed" |
| 90 | + """Notification indicating that the list of roots has changed.""" |
| 91 | + ELICITATION_CREATE = "elicitation/create" |
| 92 | + """Request from the server to elicit additional information from the user via the client.""" |
0 commit comments