-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.tsx
More file actions
40 lines (36 loc) · 992 Bytes
/
index.tsx
File metadata and controls
40 lines (36 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
// Add WebMCP Tool definitions
if (typeof navigator !== 'undefined' && 'modelContext' in navigator) {
(navigator as any).modelContext?.provideContext({
tools: [
{
name: "count_words",
description: "Counts words in a text",
inputSchema: {
type: "object",
properties: {
text: { type: "string" }
},
required: ["text"]
},
execute: async (args: any) => {
const text = args.text || "";
const count = text.trim() ? text.trim().split(/\s+/).length : 0;
return { wordCount: count };
}
}
]
});
}
const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error("Could not find root element to mount to");
}
const root = ReactDOM.createRoot(rootElement);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);