Lessons 4–5: Inspector connection failures, terminal HTTP 500s, and a fix for parallel tool calls in process_query()

I found the server and client walkthroughs helpful. I ran into a few issues in the hosted notebooks and wanted to share what I tested.

Lesson 4 — Creating an MCP Server. The lab’s MCP Inspector v0.11.0 failed to connect. Chrome showed HTTP 524 on /stdio, and the Inspector proxy returned HTTP 500 with SSE connection not established on /message. A direct Jupyter test connected over STDIO and ran search_papers successfully. I also ran both tools successfully in Inspector v2.17.0 on Windows.

Lesson 5 — Creating an MCP Client. The chatbot discovered both tools, but Claude requests from the course terminal returned HTTP 500, including a minimal request with no tools. Running the chatbot from a Jupyter code cell worked.

In Jupyter, I reproduced a separate HTTP 400 when Claude requested two extract_info calls in one reply. The original process_query() sent a result back before collecting all the results for that reply. I updated it to collect one tool_result per tool_use, then send all the results in a single message with their matching tool_use_id values. I verified the fix in Jupyter by requesting details for two saved paper IDs and receiving the titles and authors for both.
updated code:

async def process_query(self, query):

    messages = \[{'role':'user', 'content':query}\]

    response = self.anthropic.messages.create(max_tokens = 2024,

                                  #model = 'claude-3-7-sonnet-20250219', #deprecated model

                                  model = 'claude-sonnet-4-6',

                                  tools = self.available_tools, # tools exposed to the LLM

                                  messages = messages)

    process_query = True

    while process_query:

        tool_results = \[\]

        for content in response.content:

            if content.type =='text':

                print(content.text)            

            elif content.type == 'tool_use': 

                tool_id = content.id

                tool_args = content.input

                tool_name = content.name

                print(f"Calling tool {tool_name} with args {tool_args}")

                \# Call a tool

                #result = execute_tool(tool_name, tool_args): not anymore needed

                \# tool invocation through the client session

                result = await self.session.call_tool(tool_name, arguments=tool_args)

                tool_results.append({

                                    "type": "tool_result",

                                    "tool_use_id": tool_id,

                                    "content": result.content,

                                    })

            

        if not tool_results:

            return  



        messages.append({"role": "assistant", "content": response.content})

        messages.append({"role": "user", "content": tool_results})

        response = self.anthropic.messages.create(max_tokens = 2024,

                                    #model = 'claude-3-7-sonnet-20250219', #deprecated model

                                  model = 'claude-sonnet-4-6', 

                                  tools = self.available_tools,

                                  messages = messages)