MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestStripMCPAppsMetadata

Function TestStripMCPAppsMetadata

pkg/inventory/registry_test.go:2000–2020  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1998}
1999
2000func TestStripMCPAppsMetadata(t *testing.T) {
2001 tools := []ServerTool{
2002 mockToolWithMeta("tool1", "toolset1", map[string]any{"ui": "data"}),
2003 mockToolWithMeta("tool2", "toolset1", map[string]any{"description": "kept"}),
2004 mockTool("tool3", "toolset1", true), // nil meta
2005 }
2006
2007 result := stripMCPAppsMetadata(tools)
2008
2009 require.Len(t, result, 3)
2010
2011 // tool1: ui should be stripped, meta becomes nil
2012 require.Nil(t, result[0].Tool.Meta, "tool1 meta should be nil after stripping ui")
2013
2014 // tool2: unchanged (compare by key since types differ)
2015 require.Equal(t, "kept", result[1].Tool.Meta["description"])
2016 require.Len(t, result[1].Tool.Meta, 1)
2017
2018 // tool3: unchanged (nil)
2019 require.Nil(t, result[2].Tool.Meta)
2020}
2021
2022func TestStripMetaKeys_MultipleKeys(t *testing.T) {
2023 // This test verifies the mechanism works for multiple keys

Callers

nothing calls this directly

Calls 3

mockToolWithMetaFunction · 0.85
stripMCPAppsMetadataFunction · 0.85
mockToolFunction · 0.70

Tested by

no test coverage detected