Coverage for mcp/tools/config.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.14.1, created at 2026-06-15 15:07 +0000

1"""CLI configuration MCP tools (read-only).""" 

2 

3import asyncio 

4 

5import cli_runner 

6from audit import audit_logged 

7from server import mcp 

8 

9 

10@mcp.tool(tags={"safe", "config"}) 

11@audit_logged 

12async def config_get(key: str | None = None) -> str: 

13 """`gco config get` — read a CLI configuration value. 

14 

15 Args: 

16 key: Configuration key to read. If omitted, returns the full config. 

17 """ 

18 args = ["config", "get"] 

19 if key: 

20 args.append(key) 

21 return await asyncio.to_thread(cli_runner._run_cli, *args)