microsoft/autogen · error · ValueError

The tool '{tool_call.name}' is not available.

Error message

The tool '{tool_call.name}' is not available.

What it means

Raised while handling a tool call when a tool with the requested name exists in _original_tools lookup but the exact name from the model's function call doesn't match any registered tool. The service (model) emitted a function call whose name has no counterpart among the client-side Tool objects registered on this agent.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/agents/azure/_azure_ai_agent.py:560

    async def _execute_tool_call(self, tool_call: FunctionCall, cancellation_token: CancellationToken) -> str:
        """
        Execute a tool call requested by the Azure AI agent.

        Args:
            tool_call (FunctionCall): The function call information including name and arguments
            cancellation_token (CancellationToken): Token for cancellation handling

        Returns:
            str: The string representation of the tool call result

        Raises:
            ValueError: If the requested tool is not available or no tools are registered
        """
        if not self._original_tools:
            raise ValueError("No tools are available.")
        tool = next((t for t in self._original_tools if t.name == tool_call.name), None)
        if tool is None:
            raise ValueError(f"The tool '{tool_call.name}' is not available.")
        arguments = json.loads(tool_call.arguments)
        result = await tool.run_json(arguments, cancellation_token, call_id=tool_call.id)
        return tool.return_value_as_string(result)

    async def _upload_files(
        self,
        file_paths: str | Iterable[str],
        purpose: str = "assistant",
        polling_interval: float = 0.5,
        cancellation_token: Optional[CancellationToken] = None,
    ) -> List[str]:
        """
        Upload files to the Azure AI Assistant API.

        This method handles uploading one or more files to be used by the agent
        and tracks their IDs in the agent's state.

        Args:

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Make the registered Tool's name exactly match the name in the tool definition sent to the service (verify FunctionTool(name=...) vs the definition).
  2. Re-attach the original tools before resuming a thread that has pending tool calls.
  3. If the model invented the name, tighten the tool description/prompt or lower temperature; optionally retry the turn.
  4. Add a fallback handler that returns an error string to the model instead of raising, so the run can continue.

Example fix

# before
FunctionTool(get_weather, name="weather")  # service calls "get_weather"
# after
FunctionTool(get_weather, name="get_weather")  # match the advertised name
Defensive patterns

Strategy: validation

Validate before calling

registered = {t.name for t in original_tools}
advertised = {d.name for d in api_tool_definitions}
mismatch = advertised - registered
assert not mismatch, f"Definitions without implementations: {mismatch}"

Try / catch

try:
    resp = await agent.on_messages(msgs, ct)
except ValueError as e:
    if "is not available" in str(e):
        # name drift: rebuild tools so FunctionTool.name matches the definition
        ...

Prevention

When it happens

Trigger: The model hallucinates or mutates a tool name (e.g. get_weather_2, camelCase vs snake_case); the tool set changed between the run that produced the pending call and the current agent; a FunctionTool was registered under a different name than the FunctionToolDefinition advertised.

Common situations: Renaming a function without updating its schema/name; resuming an old thread after deploying new tool names; schemas generated from docstrings where the name drifted from the implementation.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/3bc2c70a6b2f71eb. Report an issue: GitHub.