// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_AI_Agents_Mcp_H #define WINRT_Windows_AI_Agents_Mcp_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/impl/Windows.AI.Agents.Mcp.2.h" namespace winrt::impl { template auto consume_Windows_AI_Agents_Mcp_IMcpMessageFilterExperimental::Initialize(param::hstring const& clientAppUserModelId, uint32_t clientProcessId, param::hstring const& serverIdentity, param::hstring const& serverName, uint32_t serverProcessId) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Initialize(*(void**)(&clientAppUserModelId), clientProcessId, *(void**)(&serverIdentity), *(void**)(&serverName), serverProcessId)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Initialize(*(void**)(&clientAppUserModelId), clientProcessId, *(void**)(&serverIdentity), *(void**)(&serverName), serverProcessId)); } } template auto consume_Windows_AI_Agents_Mcp_IMcpMessageFilterExperimental::OnMessage(param::hstring const& message, winrt::Windows::AI::Agents::Mcp::McpMessageDirection const& direction, winrt::Windows::AI::Agents::Mcp::McpMessageFilterResponse const& filterResponse) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->OnMessage(*(void**)(&message), static_cast(direction), *(void**)(&filterResponse))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->OnMessage(*(void**)(&message), static_cast(direction), *(void**)(&filterResponse))); } } template auto consume_Windows_AI_Agents_Mcp_IMcpMessageFilterResponseExperimental::IsAllowed() const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_IsAllowed(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsAllowed(&value)); } return value; } template auto consume_Windows_AI_Agents_Mcp_IMcpMessageFilterResponseExperimental::IsAllowed(bool value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_IsAllowed(value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_IsAllowed(value)); } } template auto consume_Windows_AI_Agents_Mcp_IMcpMessageFilterResponseExperimental::MessageIfNotAllowed() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_MessageIfNotAllowed(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_MessageIfNotAllowed(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_AI_Agents_Mcp_IMcpMessageFilterResponseExperimental::MessageIfNotAllowed(param::hstring const& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_MessageIfNotAllowed(*(void**)(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_MessageIfNotAllowed(*(void**)(&value))); } } template auto consume_Windows_AI_Agents_Mcp_IMcpMessageFilterResponseExperimental2::Allow() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Allow()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Allow()); } } template auto consume_Windows_AI_Agents_Mcp_IMcpMessageFilterResponseExperimental2::Reject(param::hstring const& reason) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Reject(*(void**)(&reason))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Reject(*(void**)(&reason))); } } template struct produce : produce_base { int32_t __stdcall Initialize(void* clientAppUserModelId, uint32_t clientProcessId, void* serverIdentity, void* serverName, uint32_t serverProcessId) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Initialize(*reinterpret_cast(&clientAppUserModelId), clientProcessId, *reinterpret_cast(&serverIdentity), *reinterpret_cast(&serverName), serverProcessId); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall OnMessage(void* message, int32_t direction, void* filterResponse) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().OnMessage(*reinterpret_cast(&message), *reinterpret_cast(&direction), *reinterpret_cast(&filterResponse)); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { }; #endif template struct produce : produce_base { int32_t __stdcall get_IsAllowed(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsAllowed()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_IsAllowed(bool value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().IsAllowed(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_MessageIfNotAllowed(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().MessageIfNotAllowed()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_MessageIfNotAllowed(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().MessageIfNotAllowed(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } }; template struct produce : produce_base { int32_t __stdcall Allow() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Allow(); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Reject(void* reason) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Reject(*reinterpret_cast(&reason)); return 0; } catch (...) { return to_hresult(); } }; } WINRT_EXPORT namespace winrt::Windows::AI::Agents::Mcp { } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif