MCPcopy
hub / github.com/wshobson/agents / test_tool_name_rewriting

Method test_tool_name_rewriting

tools/tests/test_adapters.py:952–976  ·  view source on GitHub ↗
(self, tmp_path: Path, output_root: Path)

Source from the content-addressed store, hash-verified

950 assert "color" not in fm
951
952 def test_tool_name_rewriting(self, tmp_path: Path, output_root: Path):
953 from tools.tests.conftest import _make_agent
954
955 plugin_dir = tmp_path / "demo"
956 plugin_dir.mkdir()
957 (plugin_dir / ".claude-plugin").mkdir()
958 (plugin_dir / ".claude-plugin" / "plugin.json").write_text('{"name": "demo"}')
959 agent = _make_agent(
960 plugin_dir,
961 "tool-user",
962 "name: tool-user\ndescription: Use when tooling.\ntools: Read, Write, Bash",
963 "# Tool User\n\nUse the `Read` tool to read and `Bash` to execute.\n",
964 )
965 plugin = PluginSource(
966 name="demo", dir=plugin_dir, plugin_json={"name": "demo"}, agents=[agent]
967 )
968 CopilotAdapter(output_root=output_root).emit_plugin(plugin)
969
970 content = (output_root / ".copilot" / "agents" / "demo__tool-user.agent.md").read_text()
971 fm, body = parse_frontmatter(content)
972 assert fm["tools"] == ["read", "edit", "execute"]
973 assert "`read`" in body
974 assert "`execute`" in body
975 assert "`Read`" not in body
976 assert "`Bash`" not in body
977
978 def test_model_alias_resolution(self, tmp_path: Path, output_root: Path):
979 from tools.tests.conftest import _make_agent

Callers

nothing calls this directly

Calls 5

_make_agentFunction · 0.90
PluginSourceClass · 0.90
CopilotAdapterClass · 0.90
parse_frontmatterFunction · 0.90
emit_pluginMethod · 0.45

Tested by

no test coverage detected