cwiki_space_info
Get metadata for the configured Apache Confluence space. Use force_refresh to fetch current data.
Instructions
Get metadata for the configured Apache Confluence space.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force_refresh | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/incubator_cwiki_mcp/tools.py:15-21 (registration)Tool registration via @mcp.tool() decorator on the cwiki_space_info function.
@mcp.tool() def cwiki_space_info(force_refresh: bool = False) -> dict[str, Any]: """Get metadata for the configured Apache Confluence space.""" return client.confluence_get( f"/rest/api/space/{urllib.parse.quote(client.SPACE_KEY)}", force_refresh=force_refresh, ) - src/incubator_cwiki_mcp/tools.py:16-21 (handler)The handler function that calls client.confluence_get with the space API endpoint.
def cwiki_space_info(force_refresh: bool = False) -> dict[str, Any]: """Get metadata for the configured Apache Confluence space.""" return client.confluence_get( f"/rest/api/space/{urllib.parse.quote(client.SPACE_KEY)}", force_refresh=force_refresh, ) - The confluence_get helper function that makes or caches the HTTP request.
def confluence_get( path: str, query: dict[str, str] | None = None, *, force_refresh: bool = False, ) -> dict[str, Any]: suffix = "" if query: suffix = "?" + urllib.parse.urlencode(query) request_path = f"{path}{suffix}" if not force_refresh: cached = cache.read_cache(request_path, BASE_URL, SPACE_KEY) if cached is not None: return cached response = confluence_request(request_path) cache.write_cache(request_path, response, BASE_URL, SPACE_KEY) return response - Configuration constants BASE_URL and SPACE_KEY used by the tool.
BASE_URL = os.getenv("CWIKI_BASE_URL", "https://cwiki.apache.org/confluence").rstrip("/") SPACE_KEY = os.getenv("CWIKI_SPACE_KEY", "INCUBATOR") - tests/test_server.py:69-75 (helper)Test case verifying that cwiki_space_info calls the correct API path with the configured space key.
def test_space_info_uses_configured_space(monkeypatch: pytest.MonkeyPatch): calls = patch_request(monkeypatch, lambda path: {"key": "INCUBATOR", "path": path}) response = tools.cwiki_space_info() assert response == {"key": "INCUBATOR", "path": "/rest/api/space/INCUBATOR"} assert calls == ["/rest/api/space/INCUBATOR"]