<script setup lang="ts">
import { ref, watch, onMounted } from 'vue';
import '@mcp-b/char/web-component';
import type { WebMCPAgentElement } from '@mcp-b/char/web-component';
const props = defineProps<{ idToken: string; clientId: string }>();
const agentRef = ref<WebMCPAgentElement | null>(null);
const connectAgent = () => {
agentRef.value?.connect({ idToken: props.idToken, clientId: props.clientId });
};
onMounted(connectAgent);
watch(() => props.idToken, connectAgent);
</script>
<template>
<char-agent ref="agentRef" />
</template>