python-sdk API reference
400 public APIs from python-sdk (modelcontextprotocol/python-sdk) — 189 classes, 143 functions, 68 methods. Signatures extracted by static analysis of the actual source.
Repository: modelcontextprotocol/python-sdk
| Kind | Count |
|---|---|
| Classes | 189 |
| Functions | 143 |
| Methods | 68 |
API list
func
.github.actions.conformance.client.client_mode() -> strPick the Client(mode=) for the harness leg.
func
.github.actions.conformance.client.fetch_id_jag(audience:str, resource:str) -> strLeg 1 - RFC 8693 token-exchange at the enterprise IdP.
func
.github.actions.conformance.client.main() -> NoneMain entry point for the conformance client.
func
.github.actions.conformance.client.register(name:str) -> Callable[[ScenarioHandler], ScenarioHandler]Register a scenario handler.
func
.github.actions.conformance.client.run_auth_code_client(server_url:str) -> NoneAuthorization code flow (default for auth/* scenarios).
func
.github.actions.conformance.client.run_initialize(server_url:str) -> NoneConnect, initialize, list tools, close.
func
.github.actions.conformance.client.run_sse_retry(server_url:str) -> NoneConnect, list tools, call test_reconnection, close.
func
.github.actions.conformance.client.run_tools_call(server_url:str) -> NoneConnect, list tools, call add_numbers(a=5, b=3), close.
func
docs_src.apps.tutorial002.refresh_dashboard() -> strRefresh the dashboard data.
func
docs_src.apps.tutorial003.refresh_report() -> strRefresh the report data.
func
docs_src.asgi.tutorial001.add_note(text:str) -> strSave a note.
func
docs_src.asgi.tutorial002.add_note(text:str) -> strSave a note.
func
docs_src.asgi.tutorial003.add_note(text:str) -> strSave a note.
func
docs_src.asgi.tutorial003.add_task(title:str) -> strCreate a task.
func
docs_src.asgi.tutorial004.add_note(text:str) -> strSave a note.
func
docs_src.asgi.tutorial005.add_note(text:str) -> strSave a note.
func
docs_src.asgi.tutorial006.add_note(text:str) -> strSave a note.
func
docs_src.authorization.tutorial001.list_notes() -> list[str]List every note in the notebook.
func
docs_src.authorization.tutorial002.whoami() -> strReport which OAuth client is calling.
func
docs_src.client.tutorial001.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.client.tutorial002.search_books(query:str, limit:int=10) -> strSearch the catalog by title or author.
func
docs_src.client.tutorial003.lookup_book(title:str) -> BookLook up a book by its exact title.
func
docs_src.client.tutorial004.books_in_genre(genre:str) -> strEvery title we stock in one genre.
func
docs_src.client.tutorial004.genres() -> list[str]The genres the catalog is organised by.
func
docs_src.client.tutorial005.recommend(genre:str) -> strAsk for a recommendation in a genre.
func
docs_src.client.tutorial006.recommend(genre:str) -> strAsk for a recommendation in a genre.
func
docs_src.client.tutorial007.reserve_book(title:str) -> strPut a book on hold.
func
docs_src.client.tutorial007.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.client_callbacks.tutorial001.issue_card(ctx:Context) -> strIssue a new library card.
func
docs_src.client_callbacks.tutorial003.client_features(ctx:Context) -> list[str]Which optional features the connected client declared.
func
docs_src.client_callbacks.tutorial003.issue_card(ctx:Context) -> strIssue a new library card.
func
docs_src.client_transports.tutorial001.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.completions.tutorial001.github_repo(owner:str, repo:str) -> strA GitHub repository.
func
docs_src.completions.tutorial001.review_code(language:str, code:str) -> strReview a snippet of code.
func
docs_src.completions.tutorial002.github_repo(owner:str, repo:str) -> strA GitHub repository.
func
docs_src.completions.tutorial002.review_code(language:str, code:str) -> strReview a snippet of code.
func
docs_src.completions.tutorial003.github_repo(owner:str, repo:str) -> strA GitHub repository.
func
docs_src.completions.tutorial003.review_code(language:str, code:str) -> strReview a snippet of code.
func
docs_src.context.tutorial001.search_books(query:str, ctx:Context) -> strSearch the catalog by title or author.
func
docs_src.context.tutorial002.describe_catalog(ctx:Context) -> strDescribe how the catalog is organised.
func
docs_src.context.tutorial002.genres() -> strThe genres the catalog is organised into.
func
docs_src.context.tutorial003.enable_recommendations(ctx:Context) -> strSwitch on the recommendation tool.
func
docs_src.context.tutorial003.recommend_book(genre:str) -> strRecommend a book in the given genre.
func
docs_src.dependencies.tutorial001.reserve_book(title:str, stock:Annotated[Stock, Resolve(check_stock)]) -> strReserve a copy of a book.
func
docs_src.dependencies.tutorial002.order_book(title:str, stock:Annotated[Stock, Resolve(check_stock)], delivery:Annotated[str, Resolve(estimate_delivery)]) -> strOrder a book from the shop.
func
docs_src.dependencies.tutorial003.order_book(title:str, stock:Annotated[Stock, Resolve(check_stock)], backorder:Annotated[Backorder, Resolve(confirm_backorder)]) -> strOrder a book from the shop.
func
docs_src.dependencies.tutorial004.recommend_book(genre:str, suggestion:Annotated[CreateMessageResult, Resolve(suggest_title)]) -> strRecommend a book in the given genre.
func
docs_src.deploy.tutorial001.add_note(text:str) -> strSave a note.
func
docs_src.deploy.tutorial002.refund(amount:int, ctx:Context) -> str | InputRequiredResultRefund an amount, once a human has confirmed it.
func
docs_src.deploy.tutorial003.make_server(key:str) -> MCPServerEvery worker process: the same key, and the same name.
func
docs_src.deploy.tutorial003.refund(amount:int, ctx:Context) -> str | InputRequiredResultRefund an amount, once a human has confirmed it.
func
docs_src.deploy.tutorial004.edit_note(name:str, text:str, ctx:Context) -> strReplace a note's text.
func
docs_src.deploy.tutorial004.note(name:str) -> strOne note, by name.
func
docs_src.elicitation.tutorial001.book_table(date:str, party_size:int, ctx:Context) -> strBook a table at the bistro.
func
docs_src.elicitation.tutorial002.confirm_deposit(booking_id:str, ctx:Context) -> strRecord a payment reported by the payment provider.
func
docs_src.elicitation.tutorial002.pay_deposit(booking_id:str, ctx:Context) -> strTake the deposit that confirms a booking.
func
docs_src.extensions.tutorial003.stamp(text:str) -> strStamp a message with the office seal.
class
docs_src.extensions.tutorial004.SearchAn extension that serves its own request method.
class
docs_src.extensions.tutorial005.AuditLogObserve every tools/call without touching its result.
func
docs_src.extensions.tutorial005.add(a:int, b:int) -> intAdd two numbers.
func
docs_src.extensions.tutorial006.buy(item:str) -> types.CallToolResultBuy an item.
func
docs_src.extensions.tutorial006.redeem(token:str) -> strExchange a receipt token for the goods.
func
docs_src.first_steps.tutorial001.add(a:int, b:int) -> intAdd two numbers.
func
docs_src.first_steps.tutorial001.greeting(name:str) -> strGreet someone by name.
func
docs_src.first_steps.tutorial001.summarize(text:str) -> strSummarize a piece of text in one sentence.
func
docs_src.handling_errors.tutorial001.get_author(title:str) -> strLook up the author of a book in the catalog.
func
docs_src.handling_errors.tutorial002.get_author(title:str) -> strLook up the author of a book in the catalog.
func
docs_src.handling_errors.tutorial003.book(title:str) -> strThe catalog entry for one book.
func
docs_src.index.tutorial001.add(a:int, b:int) -> intAdd two numbers.
func
docs_src.index.tutorial001.greeting(name:str) -> strGreet someone by name.
func
docs_src.legacy_clients.tutorial003.restock(title:str, copies:int, ctx:Context) -> strPut copies of a book back on the shelf.
func
docs_src.legacy_clients.tutorial003.stock(title:str) -> strHow many copies of one book are on the shelf.
func
docs_src.lifespan.tutorial001.count_books(genre:str, ctx:Context[AppContext]) -> strCount the books in a genre.
func
docs_src.lifespan.tutorial002.database_status(ctx:Context[AppContext]) -> strReport whether the database connection is up.
func
docs_src.logging.tutorial001.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.media.tutorial001.logo() -> ImageThe brand logo as a PNG.
func
docs_src.media.tutorial002.chime() -> AudioThe notification chime as a WAV.
func
docs_src.media.tutorial002.logo() -> ImageThe brand logo as a PNG.
func
docs_src.media.tutorial003.logo_from_bytes() -> ImageThe brand logo as a PNG.
func
docs_src.media.tutorial004.guidelines() -> strHow to use the brand assets.
func
docs_src.media.tutorial004.palette() -> list[str]The brand colour palette as hex codes.
func
docs_src.mrtr.tutorial004.briefing(ctx:Context) -> list[UserMessage] | InputRequiredResultDraft a briefing tuned to its audience.
func
docs_src.opentelemetry.tutorial001.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.progress.tutorial001.import_catalog(urls:list[str], ctx:Context) -> strImport book records from a list of catalog URLs.
func
docs_src.progress.tutorial002.import_feed(feed_url:str, ctx:Context) -> strImport every record a catalog feed yields.
func
docs_src.prompts.tutorial001.review_code(code:str) -> strReview a piece of code.
func
docs_src.prompts.tutorial002.debug_error(error:str) -> list[Message]Start a debugging conversation.
func
docs_src.prompts.tutorial002.review_code(code:str) -> strReview a piece of code.
func
docs_src.prompts.tutorial003.review_code(code:Annotated[str, Field(description='The code to review.')], language:Annotated[str, Field(description='The language the code is written in.')]='python') -> strReview a piece of code.
func
docs_src.protocol_versions.tutorial001.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.protocol_versions.tutorial002.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.protocol_versions.tutorial003.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.protocol_versions.tutorial004.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.real_host.tutorial001.get_author(title:str) -> strLook up the author of a book in the catalog.
func
docs_src.real_host.tutorial001.search_books(query:str) -> list[str]Search the catalog by title or author.
func
docs_src.real_host.tutorial001.titles() -> strEvery title in the catalog, one per line.
func
docs_src.resources.tutorial001.get_config() -> strThe active shop configuration.
func
docs_src.resources.tutorial002.get_config() -> strThe active shop configuration.
func
docs_src.resources.tutorial002.get_user_profile(user_id:str) -> strA customer's profile.
func
docs_src.resources.tutorial003.catalog_stats() -> dict[str, int]Live counts for the catalog.
func
docs_src.resources.tutorial003.readme() -> strHow to use this server.
func
docs_src.run.tutorial001.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.run.tutorial002.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.run.tutorial003.search_books(query:str) -> strSearch the catalog by title or author.
func
docs_src.sampling_and_roots.tutorial001.blurb(title:str, draft:Annotated[CreateMessageResult, Resolve(draft_blurb)]) -> strDraft a blurb for a book.
func
docs_src.session_groups.tutorial001.hours() -> strWhen the library is open.
func
docs_src.session_groups.tutorial001.search(query:str) -> strSearch the library catalog.
func
docs_src.session_groups.tutorial002.search(query:str) -> strSearch the web.
func
docs_src.structured_output.tutorial001.get_temperature(city:str) -> intCurrent temperature in a city, in whole degrees Celsius.
func
docs_src.structured_output.tutorial002.get_weather(city:str) -> WeatherDataCurrent weather for a city.
func
docs_src.structured_output.tutorial003.get_weather(city:str) -> WeatherDataCurrent weather for a city.
func
docs_src.structured_output.tutorial004.get_weather(city:str) -> WeatherDataCurrent weather for a city.
func
docs_src.structured_output.tutorial005.get_forecast(city:str, days:int) -> list[WeatherData]Daily forecast for a city.
func
docs_src.structured_output.tutorial007.get_weather(city:str) -> WeatherDataCurrent weather for a city.
func
docs_src.structured_output.tutorial008.weather_report(city:str) -> strA human-readable weather report for a city.
func
docs_src.structured_output.tutorial009.get_station(name:str) -> StationLook up a weather station by name.
func
docs_src.troubleshooting.tutorial001.forecast(city:str) -> strToday's forecast for one city.
func
docs_src.troubleshooting.tutorial001.report(city:str) -> strThe full report for one city.
func
docs_src.troubleshooting.tutorial002.forecast_hourly(city:str, hours:int) -> strThe next few hours for one city.
func
docs_src.troubleshooting.tutorial002.forecast_today(city:str) -> strToday's forecast for one city.
func
docs_src.troubleshooting.tutorial003.forecast(city:str) -> strToday's forecast for one city.
func
docs_src.troubleshooting.tutorial004.forecast(city:str) -> strToday's forecast for one city.
func
docs_src.troubleshooting.tutorial005.forecast(city:str) -> strToday's forecast for one city.
func
docs_src.troubleshooting.tutorial006.book_table(date:str, ctx:Context) -> strBook a table at the bistro.
func
docs_src.troubleshooting.tutorial007.ask_to_confirm(date:str) -> Elicit[Confirmation]Resolver: ask the user to confirm the booking.
func
docs_src.troubleshooting.tutorial007.book_table(date:str, answer:Annotated[Confirmation, Resolve(ask_to_confirm)]) -> strBook a table at the bistro.
func
docs_src.troubleshooting.tutorial008.book_table(date:str, ctx:Context) -> strBook a table at the bistro.
func
docs_src.uri_templates.tutorial001.browse_shelf(path:list[str]) -> strA shelf in the category tree, addressed by segments.
func
docs_src.uri_templates.tutorial001.get_book(isbn:str) -> dict[str, str]A single book by ISBN.
func
docs_src.uri_templates.tutorial001.get_order(order_id:int) -> dict[str, object]An order by its numeric id.
func
docs_src.uri_templates.tutorial001.list_reviews(isbn:str, limit:int=10, sort:str='newest') -> strReviews of a book, optionally limited and sorted.
func
docs_src.uri_templates.tutorial001.read_manual(path:str) -> strA staff manual page.
func
docs_src.uri_templates.tutorial002.read_manual(path:str) -> strA staff manual page, served from a directory on disk.
func
docs_src.uri_templates.tutorial003.preview_import(source:str) -> strPreview a catalog import.
func
docs_src.uri_templates.tutorial003.preview_import_relaxed(source:str) -> strThe server-wide flag exempts every resource on `relaxed`.
class
src.mcp-types.mcp_types._types.AudioContentAudio provided to or from an LLM.
class
src.mcp-types.mcp_types._types.BlobResourceContentsBinary contents of a resource.
class
src.mcp-types.mcp_types._types.CallToolResultThe server's response to a tool call.
class
src.mcp-types.mcp_types._types.CancelTaskRequestA request to cancel a task (2025-11-25 only).
class
src.mcp-types.mcp_types._types.ClientCapabilitiesCapabilities a client may support.
class
src.mcp-types.mcp_types._types.CompletionCompletion information.
class
src.mcp-types.mcp_types._types.CompletionContextAdditional, optional context for completions.
class
src.mcp-types.mcp_types._types.CompletionsCapabilityCapability for completions operations.
class
src.mcp-types.mcp_types._types.ElicitRequestFormParamsParameters for form mode elicitation requests.
class
src.mcp-types.mcp_types._types.ElicitRequestURLParamsParameters for URL mode elicitation requests.
class
src.mcp-types.mcp_types._types.ElicitResultThe client's response to an elicitation request.
class
src.mcp-types.mcp_types._types.ElicitationCapabilityCapability for elicitation operations.
class
src.mcp-types.mcp_types._types.EmptyResultA result that indicates success but carries no data.
class
src.mcp-types.mcp_types._types.FormElicitationCapabilityCapability for form mode elicitation.
class
src.mcp-types.mcp_types._types.GetTaskPayloadRequestParamsParameters for a tasks/result request.
class
src.mcp-types.mcp_types._types.ImageContentAn image provided to or from an LLM.
class
src.mcp-types.mcp_types._types.InitializeRequestParamsParameters for the `initialize` request.
class
src.mcp-types.mcp_types._types.LoggingCapabilityCapability for logging operations.
class
src.mcp-types.mcp_types._types.MCPModelBase class for all MCP protocol types.
class
src.mcp-types.mcp_types._types.ModelHintHints to use for model selection.
class
src.mcp-types.mcp_types._types.NotificationBase class for JSON-RPC notifications.
class
src.mcp-types.mcp_types._types.ProgressNotificationParamsParameters for progress notifications.
class
src.mcp-types.mcp_types._types.PromptA prompt or prompt template that the server offers.
class
src.mcp-types.mcp_types._types.PromptArgumentDescribes an argument that a prompt can accept.
class
src.mcp-types.mcp_types._types.PromptMessageDescribes a message returned as part of a prompt.
class
src.mcp-types.mcp_types._types.PromptReferenceIdentifies a prompt.
class
src.mcp-types.mcp_types._types.PromptsCapabilityCapability for prompts operations.
class
src.mcp-types.mcp_types._types.RequestBase class for JSON-RPC requests.
class
src.mcp-types.mcp_types._types.ResourceContentsThe contents of a specific resource or sub-resource.
class
src.mcp-types.mcp_types._types.ResourcesCapabilityCapability for resources operations.
class
src.mcp-types.mcp_types._types.ResultBase class for JSON-RPC results.
class
src.mcp-types.mcp_types._types.RootsCapabilityCapability for root operations.
class
src.mcp-types.mcp_types._types.SamplingCapabilitySampling capability structure.
class
src.mcp-types.mcp_types._types.ServerCapabilitiesCapabilities that a server may support.
class
src.mcp-types.mcp_types._types.SetLevelRequestParamsParameters for setting the logging level.
class
src.mcp-types.mcp_types._types.SubscribeRequestParamsParameters for subscribing to a resource.
class
src.mcp-types.mcp_types._types.TaskData associated with a task (2025-11-25 only).
class
src.mcp-types.mcp_types._types.TextContentText provided to or from an LLM.
class
src.mcp-types.mcp_types._types.TextResourceContentsText contents of a resource.
class
src.mcp-types.mcp_types._types.ToolDefinition for a tool the client can call.
class
src.mcp-types.mcp_types._types.ToolAnnotationsAdditional properties describing a Tool to clients.
class
src.mcp-types.mcp_types._types.ToolsCapabilityCapability for tools operations.
class
src.mcp-types.mcp_types._types.UnsubscribeRequestParamsParameters for a resources/unsubscribe request.
class
src.mcp-types.mcp_types._v2025_11_25.AnnotationsOptional annotations for the client.
class
src.mcp-types.mcp_types._v2025_11_25.ArgumentThe argument's information
class
src.mcp-types.mcp_types._v2025_11_25.AudioContentAudio provided to or from an LLM.
class
src.mcp-types.mcp_types._v2025_11_25.CallToolRequestParamsParameters for a `tools/call` request.
class
src.mcp-types.mcp_types._v2025_11_25.CallToolResultThe server's response to a tool call.
class
src.mcp-types.mcp_types._v2025_11_25.CancelTaskRequestA request to cancel a task.
class
src.mcp-types.mcp_types._v2025_11_25.CancelTaskResultThe response to a tasks/cancel request.
class
src.mcp-types.mcp_types._v2025_11_25.ClientCapabilitiesCapabilities a client may support.
class
src.mcp-types.mcp_types._v2025_11_25.CompleteRequestParamsParameters for a `completion/complete` request.
class
src.mcp-types.mcp_types._v2025_11_25.ContextAdditional, optional context for completions
class
src.mcp-types.mcp_types._v2025_11_25.CreateTaskResultA response to a task-augmented request.
class
src.mcp-types.mcp_types._v2025_11_25.DataAdditional information about the error.
class
src.mcp-types.mcp_types._v2025_11_25.ElicitResultThe client's response to an elicitation request.
class
src.mcp-types.mcp_types._v2025_11_25.Elicitation1Task support for elicitation-related requests.
class
src.mcp-types.mcp_types._v2025_11_25.GetPromptRequestParamsParameters for a `prompts/get` request.
class
src.mcp-types.mcp_types._v2025_11_25.GetTaskPayloadResultThe response to a tasks/result request.
class
src.mcp-types.mcp_types._v2025_11_25.GetTaskRequestA request to retrieve the state of a task.
class
src.mcp-types.mcp_types._v2025_11_25.GetTaskResultThe response to a tasks/get request.
class
src.mcp-types.mcp_types._v2025_11_25.IconsBase interface to add `icons` property.
class
src.mcp-types.mcp_types._v2025_11_25.ImageContentAn image provided to or from an LLM.
class
src.mcp-types.mcp_types._v2025_11_25.ImplementationDescribes the MCP implementation.
class
src.mcp-types.mcp_types._v2025_11_25.InitializeRequestParamsParameters for an `initialize` request.
class
src.mcp-types.mcp_types._v2025_11_25.Items1Schema for the array items.
class
src.mcp-types.mcp_types._v2025_11_25.JSONRPCNotificationA notification which does not expect a response.
class
src.mcp-types.mcp_types._v2025_11_25.JSONRPCRequestA request that expects a response.
class
src.mcp-types.mcp_types._v2025_11_25.JSONRPCResultResponseA successful (non-error) response to a request.
class
src.mcp-types.mcp_types._v2025_11_25.LegacyTitledEnumSchemaUse TitledSingleSelectEnumSchema instead.
class
src.mcp-types.mcp_types._v2025_11_25.ListTasksRequestA request to retrieve a list of tasks.
class
src.mcp-types.mcp_types._v2025_11_25.ListTasksResultThe response to a tasks/list request.
class
src.mcp-types.mcp_types._v2025_11_25.ModelHintHints to use for model selection.
class
src.mcp-types.mcp_types._v2025_11_25.PaginatedRequestParamsCommon parameters for paginated requests.
class
src.mcp-types.mcp_types._v2025_11_25.PromptA prompt or prompt template that the server offers.
class
src.mcp-types.mcp_types._v2025_11_25.PromptArgumentDescribes an argument that a prompt can accept.
class
src.mcp-types.mcp_types._v2025_11_25.PromptMessageDescribes a message returned as part of a prompt.
class
src.mcp-types.mcp_types._v2025_11_25.PromptReferenceIdentifies a prompt.
class
src.mcp-types.mcp_types._v2025_11_25.PromptsPresent if the server offers any prompt templates.
class
src.mcp-types.mcp_types._v2025_11_25.ReadResourceRequestParamsParameters for a `resources/read` request.
class
src.mcp-types.mcp_types._v2025_11_25.RelatedTaskMetadataMetadata for associating messages with a task.
class
src.mcp-types.mcp_types._v2025_11_25.RequestParamsCommon params for any request.
class
src.mcp-types.mcp_types._v2025_11_25.RequestedSchemaA restricted subset of JSON Schema.
class
src.mcp-types.mcp_types._v2025_11_25.ResourceRequestParamsCommon parameters when working with resources.
class
src.mcp-types.mcp_types._v2025_11_25.ResourcesPresent if the server offers any resources to read.
class
src.mcp-types.mcp_types._v2025_11_25.RootsPresent if the client supports listing roots.
class
src.mcp-types.mcp_types._v2025_11_25.Sampling1Task support for sampling-related requests.
class
src.mcp-types.mcp_types._v2025_11_25.ServerCapabilitiesCapabilities that a server may support.
class
src.mcp-types.mcp_types._v2025_11_25.SetLevelRequestParamsParameters for a `logging/setLevel` request.
class
src.mcp-types.mcp_types._v2025_11_25.TaskData associated with a task.
class
src.mcp-types.mcp_types._v2025_11_25.TaskAugmentedRequestParamsCommon params for any task-augmented request.
class
src.mcp-types.mcp_types._v2025_11_25.TextContentText provided to or from an LLM.
class
src.mcp-types.mcp_types._v2025_11_25.ToolDefinition for a tool the client can call.
class
src.mcp-types.mcp_types._v2025_11_25.ToolExecutionExecution-related properties for a tool.
class
src.mcp-types.mcp_types._v2025_11_25.ToolUseContentA request from the assistant to call a tool.
class
src.mcp-types.mcp_types._v2025_11_25.ToolsTask support for tool-related requests.
class
src.mcp-types.mcp_types._v2025_11_25.Tools1Present if the server offers any tools to call.
class
src.mcp-types.mcp_types._v2026_07_28.AnnotationsOptional annotations for the client.
class
src.mcp-types.mcp_types._v2026_07_28.ArgumentThe argument's information
class
src.mcp-types.mcp_types._v2026_07_28.AudioContentAudio provided to or from an LLM.
class
src.mcp-types.mcp_types._v2026_07_28.CallToolRequestParamsParameters for a `tools/call` request.
class
src.mcp-types.mcp_types._v2026_07_28.ClientCapabilitiesCapabilities a client may support.
class
src.mcp-types.mcp_types._v2026_07_28.CompleteRequestParamsParameters for a `completion/complete` request.
class
src.mcp-types.mcp_types._v2026_07_28.ContextAdditional, optional context for completions
class
src.mcp-types.mcp_types._v2026_07_28.DataAdditional information about the error.
class
src.mcp-types.mcp_types._v2026_07_28.Data1Additional information about the error.
class
src.mcp-types.mcp_types._v2026_07_28.GetPromptRequestParamsParameters for a `prompts/get` request.
class
src.mcp-types.mcp_types._v2026_07_28.IconsBase interface to add `icons` property.
class
src.mcp-types.mcp_types._v2026_07_28.ImageContentAn image provided to or from an LLM.
class
src.mcp-types.mcp_types._v2026_07_28.ImplementationDescribes the MCP implementation.
class
src.mcp-types.mcp_types._v2026_07_28.Items1Schema for the array items.
class
src.mcp-types.mcp_types._v2026_07_28.JSONRPCNotificationA notification which does not expect a response.
class
src.mcp-types.mcp_types._v2026_07_28.JSONRPCRequestA request that expects a response.
class
src.mcp-types.mcp_types._v2026_07_28.JSONRPCResultResponseA successful (non-error) response to a request.
class
src.mcp-types.mcp_types._v2026_07_28.ModelHintHints to use for model selection.
class
src.mcp-types.mcp_types._v2026_07_28.NotificationParamsCommon params for any notification.
class
src.mcp-types.mcp_types._v2026_07_28.PaginatedRequestParamsCommon params for paginated requests.
class
src.mcp-types.mcp_types._v2026_07_28.PromptA prompt or prompt template that the server offers.
class
src.mcp-types.mcp_types._v2026_07_28.PromptArgumentDescribes an argument that a prompt can accept.
class
src.mcp-types.mcp_types._v2026_07_28.PromptMessageDescribes a message returned as part of a prompt.
class
src.mcp-types.mcp_types._v2026_07_28.PromptReferenceIdentifies a prompt.
class
src.mcp-types.mcp_types._v2026_07_28.PromptsPresent if the server offers any prompt templates.
class
src.mcp-types.mcp_types._v2026_07_28.ReadResourceRequestParamsParameters for a `resources/read` request.
class
src.mcp-types.mcp_types._v2026_07_28.RequestParamsCommon params for any request.
class
src.mcp-types.mcp_types._v2026_07_28.RequestedSchemaA restricted subset of JSON Schema.
class
src.mcp-types.mcp_types._v2026_07_28.ResourceRequestParamsCommon params for resource-related requests.
class
src.mcp-types.mcp_types._v2026_07_28.ResourcesPresent if the server offers any resources to read.
class
src.mcp-types.mcp_types._v2026_07_28.ResultCommon result fields.
class
src.mcp-types.mcp_types._v2026_07_28.ServerCapabilitiesCapabilities that a server may support.
class
src.mcp-types.mcp_types._v2026_07_28.TextContentText provided to or from an LLM.
class
src.mcp-types.mcp_types._v2026_07_28.ToolDefinition for a tool the client can call.
class
src.mcp-types.mcp_types._v2026_07_28.ToolUseContentA request from the assistant to call a tool.
class
src.mcp-types.mcp_types._v2026_07_28.ToolsPresent if the server offers any tools to call.
class
src.mcp-types.mcp_types._wire_base.WireModelBase for generated wire models: enables `populate_by_name`; subclasses set `extra` themselves.
class
src.mcp-types.mcp_types.jsonrpc.ErrorDataError information for JSON-RPC error responses.
class
src.mcp-types.mcp_types.jsonrpc.JSONRPCRequestA JSON-RPC request that expects a response.
class
src.mcp-types.mcp_types.jsonrpc.JSONRPCResponseA successful (non-error) response to a request.
func
src.mcp.cli.claude.get_uv_path() -> strGet the full path to the uv executable.
func
src.mcp.cli.cli.run(file_spec:str=typer.Argument(..., help='Python file to run, optionally with :object suffix'), transport:Annotated[str | None, typer.Option('--transport', '-t', help='Transport protocol to use (stdio or sse)')]=None) -> NoneRun an MCP server.
func
src.mcp.cli.cli.version() -> NoneShow the MCP version.
func
src.mcp.client._probe.negotiate_auto(session:ClientSession) -> NoneDrive the ``mode='auto'`` connect-time policy on ``session``.
class
src.mcp.client._transport.TransportProtocol for MCP transports.
class
src.mcp.client.auth.exceptions.OAuthFlowErrorBase exception for OAuth flow errors.
class
src.mcp.client.auth.exceptions.OAuthRegistrationErrorRaised when client registration fails.
class
src.mcp.client.auth.exceptions.OAuthTokenErrorRaised when token operations fail.
class
src.mcp.client.auth.oauth2.OAuthClientProviderOAuth2 authentication for httpx2.
method
src.mcp.client.auth.oauth2.OAuthClientProvider.async_auth_flow(request:httpx2.Request) -> AsyncGenerator[httpx2.Request, httpx2.Response]httpx2 auth flow integration.
class
src.mcp.client.auth.oauth2.OAuthContextOAuth flow context.
method
src.mcp.client.auth.oauth2.OAuthContext.can_refresh_token() -> boolCheck if token can be refreshed.
method
src.mcp.client.auth.oauth2.OAuthContext.clear_tokens() -> NoneClear current tokens.
method
src.mcp.client.auth.oauth2.OAuthContext.get_authorization_base_url(server_url:str) -> strExtract base URL by removing path component.
method
src.mcp.client.auth.oauth2.OAuthContext.get_resource_url() -> strGet resource URL for RFC 8707.
method
src.mcp.client.auth.oauth2.OAuthContext.is_token_valid() -> boolCheck if current token is valid.
method
src.mcp.client.auth.oauth2.OAuthContext.update_token_expiry(token:OAuthToken) -> NoneUpdate token expiry time using shared util function.
class
src.mcp.client.auth.oauth2.PKCEParametersPKCE (Proof Key for Code Exchange) parameters.
method
src.mcp.client.auth.oauth2.PKCEParameters.generate() -> 'PKCEParameters'Generate new PKCE parameters.
class
src.mcp.client.auth.oauth2.TokenStorageProtocol for token storage implementations.
method
src.mcp.client.auth.oauth2.TokenStorage.get_client_info() -> OAuthClientInformationFull | NoneGet stored client information.
method
src.mcp.client.auth.oauth2.TokenStorage.get_tokens() -> OAuthToken | NoneGet stored tokens.
method
src.mcp.client.auth.oauth2.TokenStorage.set_client_info(client_info:OAuthClientInformationFull) -> NoneStore client information.
method
src.mcp.client.auth.oauth2.TokenStorage.set_tokens(tokens:OAuthToken) -> NoneStore tokens.
func
src.mcp.client.auth.utils.extract_field_from_www_auth(response:Response, field_name:str) -> str | NoneExtract field from WWW-Authenticate header.
func
src.mcp.client.auth.utils.handle_registration_response(response:Response) -> OAuthClientInformationFullHandle registration response.
func
src.mcp.client.auth.utils.handle_token_response_scopes(response:Response) -> OAuthTokenParse and validate a token response.
class
src.mcp.client.caching.CacheConfigConfiguration for a `Client`'s response cache.
class
src.mcp.client.caching.InMemoryResponseCacheStoreDefault in-process `ResponseCacheStore`.
class
src.mcp.client.caching.ResponseCacheStoreStorage contract for the client response cache.
class
src.mcp.client.client.ClientA high-level MCP client for connecting to MCP servers.
method
src.mcp.client.client.Client.instructions() -> str | NoneServer-provided instructions text, if any.
method
src.mcp.client.client.Client.list_prompts(*cursor:str | None=None, *meta:RequestParamsMeta | None=None, *cache_mode:CacheMode='use') -> ListPromptsResultList available prompts from the server.
method
src.mcp.client.client.Client.list_tools(*cursor:str | None=None, *meta:RequestParamsMeta | None=None, *cache_mode:CacheMode='use') -> ListToolsResultList available tools from the server.
method
src.mcp.client.client.Client.send_ping(*meta:RequestParamsMeta | None=None) -> EmptyResultSend a ping request to the server.
method
src.mcp.client.client.Client.session() -> ClientSessionGet the underlying ClientSession.
method
src.mcp.client.client.Client.set_logging_level(level:LoggingLevel, *meta:RequestParamsMeta | None=None) -> EmptyResultSet the logging level on the server.
method
src.mcp.client.session.ClientSession.discover() -> types.DiscoverResultProbe `server/discover` and adopt the result.
method
src.mcp.client.session.ClientSession.discover_result() -> types.DiscoverResult | NoneThe server's DiscoverResult.
method
src.mcp.client.session.ClientSession.initialize_result() -> types.InitializeResult | NoneThe server's InitializeResult.
method
src.mcp.client.session.ClientSession.instructions() -> str | NoneServer-provided instructions text, if any.
method
src.mcp.client.session.ClientSession.list_prompts(*params:types.PaginatedRequestParams | None=None) -> types.ListPromptsResultSend a prompts/list request.
method
src.mcp.client.session.ClientSession.list_resources(*params:types.PaginatedRequestParams | None=None) -> types.ListResourcesResultSend a resources/list request.
method
src.mcp.client.session.ClientSession.list_tools(*params:types.PaginatedRequestParams | None=None) -> types.ListToolsResultSend a tools/list request.
method
src.mcp.client.session.ClientSession.protocol_version() -> str | NoneNegotiated protocol version.
method
src.mcp.client.session.ClientSession.send_notification(notification:types.ClientNotification) -> NoneSend a one-way notification.
method
src.mcp.client.session.ClientSession.send_ping(*meta:RequestParamsMeta | None=None) -> types.EmptyResultSend a ping request.
method
src.mcp.client.session.ClientSession.send_roots_list_changed() -> NoneSend a roots/list_changed notification.
method
src.mcp.client.session.ClientSession.server_capabilities() -> types.ServerCapabilities | NoneServer capabilities.
method
src.mcp.client.session.ClientSession.server_info() -> types.Implementation | NoneServer name/version.
method
src.mcp.client.session.ClientSession.set_logging_level(level:types.LoggingLevel, *meta:RequestParamsMeta | None=None) -> types.EmptyResultSend a logging/setLevel request.
class
src.mcp.client.session_group.SseServerParametersParameters for initializing an sse_client.
class
src.mcp.client.streamable_http.RequestContextContext for a request operation.
class
src.mcp.client.streamable_http.ResumptionErrorRaised when resumption request is invalid.
class
src.mcp.client.streamable_http.StreamableHTTPErrorBase exception for StreamableHTTP transport errors.
class
src.mcp.client.streamable_http.StreamableHTTPTransportStreamableHTTP client transport implementation.
func
src.mcp.os.win32.utilities.get_windows_executable_command(command:str) -> strResolves the command to a Windows executable path.
class
src.mcp.server.apps.AppsThe MCP Apps extension: bind tools to `ui://` UI resources.
method
src.mcp.server.apps.Apps.add_resource(resource:Resource) -> NoneRegister a pre-built `ui://` resource.
method
src.mcp.server.apps.Apps.tool(*resource_uri:str, *visibility:Sequence[Visibility] | None=None, *meta:dict[str, Any] | None=None, **tool_kwargs:Any) -> Callable[[_CallableT], _CallableT]Decorator registering a tool bound to a `ui://` resource.
method
src.mcp.server.apps.Apps.tools() -> Sequence[ToolBinding]The bound tools.
class
src.mcp.server.auth.middleware.bearer_auth.AuthenticatedUserUser with authentication info.
class
src.mcp.server.auth.provider.TokenVerifierProtocol for verifying bearer tokens.
method
src.mcp.server.auth.provider.TokenVerifier.verify_token(token:str) -> AccessToken | NoneVerify a bearer token and return access info if valid.
class
src.mcp.server.caching.CacheHintFreshness hint for one cacheable method's results.
func
src.mcp.server.caching.apply_cache_hint(result:CacheableResultT, hint:CacheHint) -> CacheableResultTFill `ttl_ms`/`cache_scope` on `result` from `hint`.
method
src.mcp.server.connection.Connection.ping(*meta:Meta | None=None, *opts:CallOptions | None=None) -> NoneSend a `ping` request on the standalone stream.
class
src.mcp.server.context.ContextServer-side per-request context.
class
src.mcp.server.elicitation.AcceptedElicitationResult when user accepts the elicitation.
class
src.mcp.server.elicitation.AcceptedUrlElicitationResult when user accepts a URL mode elicitation.
class
src.mcp.server.elicitation.CancelledElicitationResult when user cancels the elicitation.
class
src.mcp.server.elicitation.DeclinedElicitationResult when user declines the elicitation.
class
src.mcp.server.extension.ExtensionBase class for an opt-in MCP extension.
method
src.mcp.server.extension.Extension.intercept_tool_call(params:CallToolRequestParams, ctx:ServerRequestContext[Any, Any], call_next:CallNext) -> HandlerResultWrap `tools/call`.
method
src.mcp.server.extension.Extension.tools() -> Sequence[ToolBinding]Tools this extension contributes (additive).
class
src.mcp.server.extension.MethodBindingA new request method an extension serves, e.g.
class
src.mcp.server.extension.ResourceBindingA pre-built resource an extension contributes.
class
src.mcp.server.extension.ToolBindingA tool an extension contributes, plus the `_meta` to stamp on it.
class
src.mcp.server.lowlevel.helper_types.ReadResourceContentsContents returned from a read_resource call.
method
src.mcp.server.lowlevel.server.Server.session_manager() -> StreamableHTTPSessionManagerGet the StreamableHTTP session manager.
func
src.mcp.server.lowlevel.server.lifespan(_:Server[Any]) -> AsyncIterator[dict[str, Any]]Default lifespan context manager that does nothing.
class
src.mcp.server.mcpserver.context.ContextContext object providing access to MCP capabilities.
method
src.mcp.server.mcpserver.context.Context.debug(data:Any, *logger_name:str | None=None) -> NoneSend a debug log message.
method
src.mcp.server.mcpserver.context.Context.elicit(message:str, schema:type[ElicitSchemaModelT]) -> ElicitationResult[ElicitSchemaModelT]Elicit information from the client/user.
method
src.mcp.server.mcpserver.context.Context.elicit_url(message:str, url:str, elicitation_id:str) -> UrlElicitationResultRequest URL mode elicitation from the client.
method
src.mcp.server.mcpserver.context.Context.error(data:Any, *logger_name:str | None=None) -> NoneSend an error log message.
method
src.mcp.server.mcpserver.context.Context.info(data:Any, *logger_name:str | None=None) -> NoneSend an info log message.
method
src.mcp.server.mcpserver.context.Context.log(level:LoggingLevel, data:Any, *logger_name:str | None=None) -> NoneSend a log message to the client.
method
src.mcp.server.mcpserver.context.Context.mcp_server() -> MCPServerAccess to the MCPServer instance.
method
src.mcp.server.mcpserver.context.Context.read_resource(uri:str | AnyUrl) -> Iterable[ReadResourceContents]Read a resource by URI.
method
src.mcp.server.mcpserver.context.Context.report_progress(progress:float, total:float | None=None, message:str | None=None) -> NoneReport progress for the current operation.
method
src.mcp.server.mcpserver.context.Context.request_id() -> strGet the unique ID for this request.
method
src.mcp.server.mcpserver.context.Context.warning(data:Any, *logger_name:str | None=None) -> NoneSend a warning log message.
class
src.mcp.server.mcpserver.exceptions.InvalidSignatureInvalid signature for use with MCPServer.
class
src.mcp.server.mcpserver.exceptions.MCPServerErrorBase error for MCPServer.
class
src.mcp.server.mcpserver.exceptions.ResourceErrorError in resource operations.
class
src.mcp.server.mcpserver.exceptions.ResourceNotFoundErrorResource does not exist.
class
src.mcp.server.mcpserver.exceptions.ToolErrorError in tool operations.
class
src.mcp.server.mcpserver.prompts.base.AssistantMessageA message from the assistant.
class
src.mcp.server.mcpserver.prompts.base.MessageBase class for all prompt messages.
method
src.mcp.server.mcpserver.prompts.base.Prompt.render(arguments:dict[str, Any] | None, context:Context[LifespanContextT, RequestT]) -> list[Message] | InputRequiredResultRender the prompt with arguments.
class
src.mcp.server.mcpserver.prompts.base.PromptArgumentAn argument that can be passed to a prompt.
class
src.mcp.server.mcpserver.prompts.base.UserMessageA message from the user.
class
src.mcp.server.mcpserver.prompts.manager.PromptManagerManages MCPServer prompts.
method
src.mcp.server.mcpserver.prompts.manager.PromptManager.add_prompt(prompt:Prompt) -> PromptAdd a prompt to the manager.
method
src.mcp.server.mcpserver.prompts.manager.PromptManager.get_prompt(name:str) -> Prompt | NoneGet prompt by name.
method
src.mcp.server.mcpserver.prompts.manager.PromptManager.list_prompts() -> list[Prompt]List all registered prompts.
method
src.mcp.server.mcpserver.prompts.manager.PromptManager.remove_prompt(name:str) -> NoneRemove a prompt by name.
class
src.mcp.server.mcpserver.resolve.ElicitA resolver's request to ask the client.
class
src.mcp.server.mcpserver.resources.base.ResourceBase class for all resources.
method
src.mcp.server.mcpserver.resources.base.Resource.read() -> str | bytesRead the resource content.
method
src.mcp.server.mcpserver.resources.base.Resource.set_default_name(name:str | None, info:ValidationInfo) -> strSet default name from URI if not provided.
class
src.mcp.server.mcpserver.resources.resource_manager.ResourceManagerManages MCPServer resources.
method
src.mcp.server.mcpserver.resources.resource_manager.ResourceManager.add_resource(resource:Resource) -> ResourceAdd a resource to the manager.
method
src.mcp.server.mcpserver.resources.resource_manager.ResourceManager.list_resources() -> list[Resource]List all registered resources.
method
src.mcp.server.mcpserver.resources.resource_manager.ResourceManager.list_templates() -> list[ResourceTemplate]List all registered templates.
class
src.mcp.server.mcpserver.resources.templates.ResourceTemplateA template for dynamically creating resources.
class
src.mcp.server.mcpserver.resources.types.BinaryResourceA resource that reads from bytes.
method
src.mcp.server.mcpserver.resources.types.BinaryResource.read() -> bytesRead the binary content.
class
src.mcp.server.mcpserver.resources.types.DirectoryResourceA resource that lists files in a directory.
method
src.mcp.server.mcpserver.resources.types.DirectoryResource.list_files() -> list[Path]List files in the directory.
method
src.mcp.server.mcpserver.resources.types.DirectoryResource.read() -> strRead the directory listing.
method
src.mcp.server.mcpserver.resources.types.DirectoryResource.validate_absolute_path(path:Path) -> PathEnsure path is absolute.
class
src.mcp.server.mcpserver.resources.types.FileResourceA resource that reads from a file.
method
src.mcp.server.mcpserver.resources.types.FileResource.read() -> str | bytesRead the file content.
method
src.mcp.server.mcpserver.resources.types.FileResource.validate_absolute_path(path:Path) -> PathEnsure path is absolute.
class
src.mcp.server.mcpserver.resources.types.HttpResourceA resource that reads from an HTTP endpoint.
method
src.mcp.server.mcpserver.resources.types.HttpResource.read() -> str | bytesRead the HTTP content.
About this data
These signatures were extracted from the public source of modelcontextprotocol/python-sdk
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.