MCPcopy Index your code
hub / github.com/Noumena-Network/code / buildModelToolSurfaceInventory

Function buildModelToolSurfaceInventory

src/surfaceInventory.ts:143–189  ·  view source on GitHub ↗
(
  tools: readonly ToolLike[],
  syntheticOutputToolName: string,
)

Source from the content-addressed store, hash-verified

141}
142
143export function buildModelToolSurfaceInventory(
144 tools: readonly ToolLike[],
145 syntheticOutputToolName: string,
146): ModelToolSurfaceEntry[] {
147 const entries = new Map<string, ModelToolSurfaceEntry>()
148
149 for (const tool of tools) {
150 entries.set(tool.name, toModelToolSurfaceEntry(tool))
151 }
152
153 entries.set(syntheticOutputToolName, {
154 name: syntheticOutputToolName,
155 aliases: [],
156 kind: 'synthetic_tool',
157 source: 'dynamic',
158 policyTier: getToolPolicy('SyntheticOutput')?.tier ?? null,
159 internalBuildOnly: false,
160 notes:
161 'Structured-output pseudo-tool synthesized when noninteractive JSON output is requested.',
162 })
163
164 entries.set('mcp__<server>__authenticate', {
165 name: 'mcp__<server>__authenticate',
166 aliases: [],
167 kind: 'dynamic_tool_family',
168 source: 'dynamic',
169 policyTier: null,
170 internalBuildOnly: false,
171 notes: 'Dynamic MCP auth pseudo-tool family.',
172 })
173
174 for (const name of ALLOWED_IDE_TOOLS) {
175 if (!entries.has(name)) {
176 entries.set(name, {
177 name,
178 aliases: [],
179 kind: 'dynamic_tool_family',
180 source: 'dynamic',
181 policyTier: null,
182 internalBuildOnly: false,
183 notes: 'Dynamic IDE MCP tool allowlisted by the NCode MCP client.',
184 })
185 }
186 }
187
188 return sortByName([...entries.values()])
189}
190
191export function buildCommandSurfaceInventory(
192 commands: readonly CommandLike[],

Calls 5

toModelToolSurfaceEntryFunction · 0.85
getToolPolicyFunction · 0.85
sortByNameFunction · 0.85
setMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected