qiskit_tutorial
Access Qiskit tutorials from the IBM Quantum Learning Hub to explore quantum computing concepts. Retrieve tutorial content in Markdown format or fetch the table of contents for available topics.
Instructions
Fetch a Qiskit tutorial from the IBM Quantum Learning Hub.
First, get the table of contents (toc) and check the tutorial names.
Tutorial names should be specified in lowercase with hyphens (e.g., "variational-quantum-eigensolver", "quantum-approximate-optimization-algorithm").
If the tutorial name is not found, it will return an error message.
Args:
tutorial_name (str): The name of the tutorial to fetch. Use "toc" for the table of contents.
If the tutorial name is not found, it will return an error message.
tutorial_name should be in lowercase and hyphenated (e.g., "variational-quantum-eigensolver", "quantum-approximate-optimization-algorithm").
Returns:
str: The tutorial content in Markdown format.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tutorial_name | Yes |
Implementation Reference
- jij_mcp/mcp_setting.py:162-191 (handler)Implementation of the qiskit_tutorial tool handler. This async function fetches Qiskit tutorials from the IBM Quantum Learning Hub by constructing the appropriate URL based on the tutorial_name (use 'toc' for table of contents) and converting the content to Markdown using fetch_as_markdown.@mcp.tool() async def qiskit_tutorial(tutorial_name: str) -> str: """ Fetch a Qiskit tutorial from the IBM Quantum Learning Hub. First, get the table of contents (toc) and check the tutorial names. Tutorial names should be specified in lowercase with hyphens (e.g., "variational-quantum-eigensolver", "quantum-approximate-optimization-algorithm"). If the tutorial name is not found, it will return an error message. Args: tutorial_name (str): The name of the tutorial to fetch. Use "toc" for the table of contents. If the tutorial name is not found, it will return an error message. tutorial_name should be in lowercase and hyphenated (e.g., "variational-quantum-eigensolver", "quantum-approximate-optimization-algorithm"). Returns: str: The tutorial content in Markdown format. """ if tutorial_name == "toc": url = "https://learning.quantum.ibm.com/catalog/tutorials" else: url = f"https://learning.quantum.ibm.com/tutorial/{tutorial_name}" response: FetchResponse = await fetch_as_markdown(url) if response.isError: return response.errorMessage if response.errorMessage else "Error fetching the content" if tutorial_name == "toc": # If the tutorial name is "toc", return the table of contents return url + "\n" + response.content[0]["text"] + "\n\n" + "Please specify the tutorial name in lowercase and hyphenated (e.g., 'variational-quantum-eigensolver')." else: return url + "\n" + response.content[0]["text"]
- jij_mcp/mcp_setting.py:162-162 (registration)The @mcp.tool() decorator registers the qiskit_tutorial function as an MCP tool.@mcp.tool()
- jij_mcp/mcp_setting.py:163-176 (schema)Input schema: tutorial_name (str). Output: str. Defined by type hints and docstring.async def qiskit_tutorial(tutorial_name: str) -> str: """ Fetch a Qiskit tutorial from the IBM Quantum Learning Hub. First, get the table of contents (toc) and check the tutorial names. Tutorial names should be specified in lowercase with hyphens (e.g., "variational-quantum-eigensolver", "quantum-approximate-optimization-algorithm"). If the tutorial name is not found, it will return an error message. Args: tutorial_name (str): The name of the tutorial to fetch. Use "toc" for the table of contents. If the tutorial name is not found, it will return an error message. tutorial_name should be in lowercase and hyphenated (e.g., "variational-quantum-eigensolver", "quantum-approximate-optimization-algorithm"). Returns: str: The tutorial content in Markdown format. """