Skip to content

docs: fix InMemoryTaskStore import path in experimental tasks docs#2739

Open
vidigoat wants to merge 1 commit into
modelcontextprotocol:mainfrom
vidigoat:fix/tasks-docs-inmemory-import
Open

docs: fix InMemoryTaskStore import path in experimental tasks docs#2739
vidigoat wants to merge 1 commit into
modelcontextprotocol:mainfrom
vidigoat:fix/tasks-docs-inmemory-import

Conversation

@vidigoat
Copy link
Copy Markdown

Summary

The experimental tasks docs show:

from mcp.shared.experimental.tasks import InMemoryTaskStore

but InMemoryTaskStore is not re-exported from the mcp.shared.experimental.tasks package, so copying this line raises ImportError: cannot import name 'InMemoryTaskStore' from 'mcp.shared.experimental.tasks'.

The package's own __init__.py directs callers to the submodule:

Import directly from submodules:

  • mcp.shared.experimental.tasks.in_memory_task_store.InMemoryTaskStore

and all library code and tests use that path (e.g. src/mcp/server/experimental/task_support.py, src/mcp/server/lowlevel/experimental.py, tests/experimental/tasks/test_elicitation_scenarios.py).

This fixes both doc snippets to the working import:

-from mcp.shared.experimental.tasks import InMemoryTaskStore
+from mcp.shared.experimental.tasks.in_memory_task_store import InMemoryTaskStore

Files: docs/experimental/tasks.md, docs/experimental/tasks-client.md.

Verification

uv sync then running the old line reproduces the ImportError; the new line imports successfully. Docs-only change.

The docs import InMemoryTaskStore from the package root:

    from mcp.shared.experimental.tasks import InMemoryTaskStore

but the class is not re-exported there, so this raises ImportError. The
package __init__ explicitly directs callers to import from the submodule,
and all library code and tests use:

    from mcp.shared.experimental.tasks.in_memory_task_store import InMemoryTaskStore

Update both doc snippets (tasks.md, tasks-client.md) to the working path.

Signed-off-by: Vidit Patankar <vidit.patankar16@gmail.com>
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