Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Hugging Face MCP calls (`mcp_call`, `mcp_list_tools`) and their results are
no longer marked `dynamic`, as in `@ai-sdk/huggingface` 2.0.62. Without a
local tool of that name, `generate_text` now returns the call marked invalid
(`NoSuchTool`), as the AI SDK's `parseToolCall` does.
- `default_providers()`, `openai()` and `anthropic()` no longer panic on an
invalid `OPENAI_BASE_URL` / `ANTHROPIC_BASE_URL`. The variable is still
read when the provider is created, as the AI SDK does; an invalid value now
Expand Down
8 changes: 4 additions & 4 deletions aimux-providers/src/huggingface/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ fn build_generate_content(response: &Value) -> Result<Vec<GenerateContent>, AiMu
tool_name: name.to_string(),
input,
provider_executed: Some(true),
dynamic: Some(true),
dynamic: None,
provider_metadata: None,
}));

Expand All @@ -1034,7 +1034,7 @@ fn build_generate_content(response: &Value) -> Result<Vec<GenerateContent>, AiMu
result: output.clone(),
is_error: None,
preliminary: None,
dynamic: Some(true),
dynamic: None,
provider_metadata: None,
}));
}
Expand All @@ -1048,7 +1048,7 @@ fn build_generate_content(response: &Value) -> Result<Vec<GenerateContent>, AiMu
tool_name: "list_tools".to_string(),
input: json!({ "server_label": server_label }).to_string(),
provider_executed: Some(true),
dynamic: Some(true),
dynamic: None,
provider_metadata: None,
}));

Expand All @@ -1059,7 +1059,7 @@ fn build_generate_content(response: &Value) -> Result<Vec<GenerateContent>, AiMu
result: json!({ "tools": tools }),
is_error: None,
preliminary: None,
dynamic: Some(true),
dynamic: None,
provider_metadata: None,
}));
}
Expand Down
6 changes: 4 additions & 2 deletions aimux-providers/tests/huggingface_responses_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,16 @@ async fn should_handle_mcp_tools_with_annotations() {
other => panic!("expected Source at [4], got {other:?}"),
}

// Like upstream, the MCP call is not dynamic: without a local `search`
// tool, Core returns it marked invalid (parseToolCall's NoSuchToolError).
let result = generate_text(&model, "Hello", GenerateTextOptions::default())
.await
.expect("dynamic MCP call should pass Core validation without local tools");
.expect("an unknown tool is an invalid call, not an error");
let call = *result.tool_calls().first().expect("MCP tool call");
assert_eq!(call.tool_name, "search");
assert_eq!(call.provider_executed, Some(true));
assert_eq!(call.dynamic, Some(true));
assert_eq!(call.invalid, None);
assert_eq!(call.invalid, Some(true));
assert_eq!(call.input, json!({ "query": "San Francisco tech events" }));
}

Expand Down
Loading