diff options
Diffstat (limited to 'catalog.lua')
| -rw-r--r-- | catalog.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/catalog.lua b/catalog.lua index d4b0c80..f73530c 100644 --- a/catalog.lua +++ b/catalog.lua @@ -39,11 +39,16 @@ function M.catalog(req, names) if names==nil then names={}; for name in pairs(all) do names[#names+1]=name end; table.sort(names) end - for i,name in ipairs(names) do - local t=assert(all[name], 'Tool not in active rig: '..name); local s=json.decode(t.input_schema_json) - assert(s.type=='object','Expected MCP object input schema for '..name) - local wire=name:gsub('%.','__'); assert(wire:match('^[%w_-]+$') and #wire<=128 and not by[wire] and wire~=M.part_tool.name, 'Invalid or colliding MCP tool name: '..name) - by[wire]={name=name,schema=s}; list[i]={name=wire,description=t.description,inputSchema=s,_meta={['antigravity/alwaysLoad']=true}} + -- An allowlist narrows the caller's declarations; a child or server + -- client need not offer every tool allowed in the primary rig. + for _,name in ipairs(names) do + local t=all[name] + if t then + local s=json.decode(t.input_schema_json) + assert(s.type=='object','Expected MCP object input schema for '..name) + local wire=name:gsub('%.','__'); assert(wire:match('^[%w_-]+$') and #wire<=128 and not by[wire] and wire~=M.part_tool.name, 'Invalid or colliding MCP tool name: '..name) + by[wire]={name=name,schema=s}; list[#list+1]={name=wire,description=t.description,inputSchema=s,_meta={['antigravity/alwaysLoad']=true}} + end end return by,list end |
