MCPcopy Index your code
hub / github.com/github/copilot-sdk / resolveToolFilterOptions

Method resolveToolFilterOptions

nodejs/src/client.ts:1151–1176  ·  view source on GitHub ↗

* Normalizes session-level tool filter options. Converts ToolSet * instances to plain string arrays, rejects misuse (bare `"*"`) and the * missing-availableTools case in `mode = "empty"`. * * The SDK always sends `toolFilterPrecedence: "excluded"` so callers can * co

(config: {
        availableTools?: string[] | ToolSet;
        excludedTools?: string[] | ToolSet;
    })

Source from the content-addressed store, hash-verified

1149 * @internal
1150 */
1151 private resolveToolFilterOptions(config: {
1152 availableTools?: string[] | ToolSet;
1153 excludedTools?: string[] | ToolSet;
1154 }): {
1155 availableTools: string[] | undefined;
1156 excludedTools: string[] | undefined;
1157 toolFilterPrecedence: "excluded";
1158 } {
1159 const availableTools = toolFilterListToArray(config.availableTools);
1160 const excludedTools = toolFilterListToArray(config.excludedTools);
1161 validateToolFilterList("availableTools", availableTools);
1162 validateToolFilterList("excludedTools", excludedTools);
1163
1164 if (this.options.mode === "empty") {
1165 if (availableTools === undefined) {
1166 throw new Error(
1167 "CopilotClient is in mode: 'empty' but the session config did not " +
1168 "specify 'availableTools'. Empty mode requires every session to " +
1169 "explicitly opt into the tools it wants — e.g. " +
1170 "`new ToolSet().addBuiltIn(BuiltInTools.Isolated)`."
1171 );
1172 }
1173 }
1174
1175 return { availableTools, excludedTools, toolFilterPrecedence: "excluded" };
1176 }
1177
1178 /** Mode-specific defaults spread under the caller's config (app values win). */
1179 private configDefaultsForMode(): Partial<SessionConfigBase> {

Callers 2

createSessionMethod · 0.95
resumeSessionMethod · 0.95

Calls 2

toolFilterListToArrayFunction · 0.85
validateToolFilterListFunction · 0.70

Tested by

no test coverage detected