Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0d6bf3e

Browse files
authored
feat: add cmd support for allowing all tools (#36)
## 🤔 WhatAllow for passing `start-server --allow-tools all` as a parameter.This helps with the ergonomics when configuring the server to take fulladvantage of all the tools.```sh $ npm run start -- start-server --allow-tools all```
1 parent18f2c84 commit0d6bf3e

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

‎src/app.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,13 @@ const DEFAULT_ALLOW_TOOLS = [
5353
];
5454
constALLOW_TOOLS_OPTIONS_TUPLE=[
5555
"-t, --allow-tools <tools>",
56-
"Comma separated list of tool ids",
57-
(val:string)=>val.split(",").map((s)=>s.trim()),
56+
"Comma separated list of tool ids (or all)",
57+
(val:string)=>{
58+
if(val.trim().toLowerCase()==="all"){
59+
returnundefined;
60+
}
61+
returnval.split(",").map((tool)=>tool.trim());
62+
},
5863
DEFAULT_ALLOW_TOOLS,
5964
]asconst;
6065

@@ -75,7 +80,7 @@ function formatErrorForCli(error: unknown): string {
7580
program
7681
.command("start-server",{isDefault:true})
7782
.description("Starts the Algolia MCP server")
78-
.option<string[]>(...ALLOW_TOOLS_OPTIONS_TUPLE)
83+
.option<string[]|undefined>(...ALLOW_TOOLS_OPTIONS_TUPLE)
7984
.option(
8085
"--credentials <applicationId:apiKey>",
8186
"Application ID and associated API key to use. Optional: the MCP will authenticate you if unspecified, giving you access to all your applications.",
@@ -116,7 +121,7 @@ program
116121
program
117122
.command("list-tools")
118123
.description("List available tools")
119-
.option<string[]>(...ALLOW_TOOLS_OPTIONS_TUPLE)
124+
.option<string[]|undefined>(...ALLOW_TOOLS_OPTIONS_TUPLE)
120125
.option("--all","List all tools")
121126
.action(async(opts:ListToolsOptions)=>{
122127
const{ listTools}=awaitimport("./commands/list-tools.ts");

‎src/commands/list-tools.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
import{operationIdasGetUserInfoOperationId}from"../tools/registerGetUserInfo.ts";
22
import{operationIdasGetApplicationsOperationId}from"../tools/registerGetApplications.ts";
33
import{ALL_SPECS,typeOpenApiSpec}from"../openApi.ts";
4+
importtype{ToolFilter}from"../toolFilters.ts";
45
import{typeCliFilteringOptions,getToolFilter,isToolAllowed}from"../toolFilters.ts";
56

7+
exportfunctiongetToolIds(toolFilter?:ToolFilter):string[]{
8+
constresults=[];
9+
for(constspecofALL_SPECS){
10+
consttoolIds=extractToolIds(spec).filter((id)=>isToolAllowed(id,toolFilter));
11+
results.push(...toolIds);
12+
}
13+
returnresults;
14+
}
15+
616
exporttypeListToolsOptions=CliFilteringOptions&{
717
all:boolean;
818
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp