Skip to content

Commit 13c9807

Browse files
committed
fix: add custom head tags for model context tool registration in Docusaurus config
1 parent a8dba8d commit 13c9807

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

site/docusaurus.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ const config: Config = {
2929

3030
clientModules: [require.resolve('./src/clientModules/webmcp.ts')],
3131

32+
headTags: [
33+
{
34+
tagName: 'script',
35+
attributes: {},
36+
innerHTML: `(function(){
37+
if(typeof navigator==='undefined'||!('modelContext' in navigator))return;
38+
var s=(new AbortController()).signal;
39+
navigator.modelContext.registerTool({name:'navigate_to_docs',description:'Navigate to a section of the raid documentation.',inputSchema:{type:'object',properties:{section:{type:'string',enum:['overview','usage','features','examples','references','whats-new']}},required:['section']},execute:function(p){var m={overview:'/docs/overview',usage:'/docs/category/usage',features:'/docs/category/features',examples:'/docs/category/examples',references:'/docs/category/references','whats-new':'/docs/whats-new'};window.location.href=m[p.section]||'/docs/overview';},signal:s});
40+
navigator.modelContext.registerTool({name:'get_install_command',description:'Returns the command to install raid on the current platform.',inputSchema:{type:'object',properties:{platform:{type:'string',enum:['macos','linux','windows']}},required:['platform']},execute:function(p){var c={macos:'brew install 8bitalex/tap/raid',linux:'curl -sSL https://github.com/8bitalex/raid/releases/latest/download/raid_linux_amd64.tar.gz | tar -xz && sudo mv raid /usr/local/bin/',windows:'scoop bucket add 8bitalex https://github.com/8bitalex/scoop-bucket && scoop install raid'};return c[p.platform]||c.macos;},signal:s});
41+
})();`,
42+
},
43+
],
44+
3245
plugins: [
3346
[
3447
'@easyops-cn/docusaurus-search-local',

0 commit comments

Comments
 (0)