Skip to content

Commit 31148d7

Browse files
authored
feat: CCSDK sync 2025-12-13 (#21)
- TaskConfig parity (SEP-1686) - Fix Windows build; stabilize streaming tests - Normalize outputSchema + structuredContent for FastMCP handler
1 parent 5f09c09 commit 31148d7

14 files changed

Lines changed: 601 additions & 149 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ target_include_directories(fastmcpp_core PUBLIC
4848
# Version header is public
4949
target_compile_definitions(fastmcpp_core PUBLIC FASTMCPP_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} FASTMCPP_VERSION_MINOR=${PROJECT_VERSION_MINOR} FASTMCPP_VERSION_PATCH=${PROJECT_VERSION_PATCH})
5050

51+
# MSVC: avoid parallel compilation PDB contention (C1041) in large targets
52+
if(MSVC)
53+
target_compile_options(fastmcpp_core PRIVATE /FS)
54+
endif()
55+
5156
# nlohmann_json dependency - use existing target if available (e.g., from vcpkg)
5257
if(NOT TARGET nlohmann_json::nlohmann_json)
5358
include(FetchContent)

include/fastmcpp/client/types.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct ToolInfo
6060
std::optional<std::string> description;
6161
fastmcpp::Json inputSchema; ///< JSON Schema for tool input
6262
std::optional<fastmcpp::Json> outputSchema; ///< JSON Schema for structured output
63+
std::optional<fastmcpp::Json> execution; ///< Execution config (SEP-1686)
6364
std::optional<std::vector<fastmcpp::Icon>> icons; ///< Icons for UI display
6465
};
6566

@@ -323,6 +324,8 @@ inline void to_json(fastmcpp::Json& j, const ToolInfo& t)
323324
j["description"] = *t.description;
324325
if (t.outputSchema)
325326
j["outputSchema"] = *t.outputSchema;
327+
if (t.execution)
328+
j["execution"] = *t.execution;
326329
if (t.icons)
327330
j["icons"] = *t.icons;
328331
}
@@ -337,6 +340,8 @@ inline void from_json(const fastmcpp::Json& j, ToolInfo& t)
337340
t.inputSchema = j.value("inputSchema", fastmcpp::Json::object());
338341
if (j.contains("outputSchema"))
339342
t.outputSchema = j["outputSchema"];
343+
if (j.contains("execution"))
344+
t.execution = j["execution"];
340345
if (j.contains("icons"))
341346
t.icons = j["icons"].get<std::vector<fastmcpp::Icon>>();
342347
}

include/fastmcpp/prompts/prompt.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ struct Prompt
3131
std::string name;
3232
std::optional<std::string> description;
3333
std::vector<PromptArgument> arguments;
34-
std::function<std::vector<PromptMessage>(const Json&)> generator; // Message generator
34+
std::function<std::vector<PromptMessage>(const Json&)> generator; // Message generator
35+
fastmcpp::TaskSupport task_support{fastmcpp::TaskSupport::Forbidden}; // SEP-1686 task mode
3536

3637
// Legacy constructor for backwards compatibility
3738
Prompt() = default;

include/fastmcpp/resources/resource.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct Resource
2626
std::optional<std::string> description; // Optional description
2727
std::optional<std::string> mime_type; // MIME type hint
2828
std::function<ResourceContent(const Json&)> provider; // Content provider function
29+
fastmcpp::TaskSupport task_support{fastmcpp::TaskSupport::Forbidden}; // SEP-1686 task mode
2930

3031
// Legacy fields (for backwards compatibility)
3132
fastmcpp::Id id;

include/fastmcpp/tools/tool.hpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,24 @@ class Tool
1818

1919
// Original constructor (backward compatible)
2020
Tool(std::string name, fastmcpp::Json input_schema, fastmcpp::Json output_schema, Fn fn,
21-
std::vector<std::string> exclude_args = {})
21+
std::vector<std::string> exclude_args = {},
22+
fastmcpp::TaskSupport task_support = fastmcpp::TaskSupport::Forbidden)
2223
: name_(std::move(name)), input_schema_(std::move(input_schema)),
2324
output_schema_(std::move(output_schema)), fn_(std::move(fn)),
24-
exclude_args_(std::move(exclude_args))
25+
exclude_args_(std::move(exclude_args)), task_support_(task_support)
2526
{
2627
}
2728

2829
// Extended constructor with title, description, icons
2930
Tool(std::string name, fastmcpp::Json input_schema, fastmcpp::Json output_schema, Fn fn,
3031
std::optional<std::string> title, std::optional<std::string> description,
3132
std::optional<std::vector<fastmcpp::Icon>> icons,
32-
std::vector<std::string> exclude_args = {})
33+
std::vector<std::string> exclude_args = {},
34+
fastmcpp::TaskSupport task_support = fastmcpp::TaskSupport::Forbidden)
3335
: name_(std::move(name)), title_(std::move(title)), description_(std::move(description)),
3436
input_schema_(std::move(input_schema)), output_schema_(std::move(output_schema)),
35-
icons_(std::move(icons)), fn_(std::move(fn)), exclude_args_(std::move(exclude_args))
37+
icons_(std::move(icons)), fn_(std::move(fn)), exclude_args_(std::move(exclude_args)),
38+
task_support_(task_support)
3639
{
3740
}
3841

@@ -67,6 +70,11 @@ class Tool
6770
return fn_(input);
6871
}
6972

73+
fastmcpp::TaskSupport task_support() const
74+
{
75+
return task_support_;
76+
}
77+
7078
// Setters for optional fields (builder pattern)
7179
Tool& set_title(std::string title)
7280
{
@@ -83,6 +91,11 @@ class Tool
8391
icons_ = std::move(icons);
8492
return *this;
8593
}
94+
Tool& set_task_support(fastmcpp::TaskSupport support)
95+
{
96+
task_support_ = support;
97+
return *this;
98+
}
8699

87100
private:
88101
fastmcpp::Json prune_schema(const fastmcpp::Json& schema) const
@@ -126,6 +139,7 @@ class Tool
126139
std::optional<std::vector<fastmcpp::Icon>> icons_;
127140
Fn fn_;
128141
std::vector<std::string> exclude_args_;
142+
fastmcpp::TaskSupport task_support_{fastmcpp::TaskSupport::Forbidden};
129143
};
130144

131145
} // namespace fastmcpp::tools

include/fastmcpp/types.hpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,38 @@ namespace fastmcpp
99

1010
using Json = nlohmann::json;
1111

12+
/// Background task execution support mode (SEP-1686).
13+
/// Mirrors fastmcp.server.tasks.TaskConfig.mode / MCP ToolExecution.taskSupport.
14+
enum class TaskSupport
15+
{
16+
Forbidden, ///< No task augmentation allowed
17+
Optional, ///< Task augmentation supported but not required
18+
Required ///< Task augmentation required
19+
};
20+
21+
inline std::string to_string(TaskSupport support)
22+
{
23+
switch (support)
24+
{
25+
case TaskSupport::Forbidden:
26+
return "forbidden";
27+
case TaskSupport::Optional:
28+
return "optional";
29+
case TaskSupport::Required:
30+
return "required";
31+
}
32+
return "forbidden";
33+
}
34+
35+
inline TaskSupport task_support_from_string(const std::string& s)
36+
{
37+
if (s == "optional")
38+
return TaskSupport::Optional;
39+
if (s == "required")
40+
return TaskSupport::Required;
41+
return TaskSupport::Forbidden;
42+
}
43+
1244
struct Id
1345
{
1446
std::string value;

src/app.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ std::vector<client::ToolInfo> FastMCP::list_all_tools_info() const
166166
info.inputSchema = tool.input_schema();
167167
info.title = tool.title();
168168
info.description = tool.description();
169-
info.outputSchema = tool.output_schema();
169+
auto out_schema = tool.output_schema();
170+
if (!out_schema.is_null())
171+
info.outputSchema = out_schema;
172+
if (tool.task_support() != TaskSupport::Forbidden)
173+
info.execution = Json{{"taskSupport", to_string(tool.task_support())}};
170174
info.icons = tool.icons();
171175
result.push_back(info);
172176
}

0 commit comments

Comments
 (0)