qiskit_tutorial
Fetch Qiskit tutorials from IBM Quantum Learning Hub to learn quantum computing concepts through practical examples and code.
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)The main handler function for the 'qiskit_tutorial' tool. It is registered via @mcp.tool() decorator. Fetches and returns Qiskit tutorial content from IBM Quantum Learning Hub in Markdown format, handling TOC separately.@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:170-176 (schema)Input schema defined in the docstring: tutorial_name (str), with specific formatting requirements and special handling for 'toc'.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. """
- jij_mcp/mcp_setting.py:162-162 (registration)Tool registration using the @mcp.tool() decorator.@mcp.tool()