jenkins_get_node
Retrieve details of any Jenkins node by name, including the built-in node.
Instructions
Get one Jenkins computer/node by name. Use (built-in) for the built-in node.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| node | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/jenkins_mcp_server/tools.py:196-200 (handler)The actual handler function for the 'jenkins_get_node' tool. Calls Jenkins API at 'computer/{node_name}/api/json', mapping empty string to '(built-in)' for the built-in node.
@mcp.tool() def jenkins_get_node(node: str) -> dict[str, Any]: """Get one Jenkins computer/node by name. Use (built-in) for the built-in node.""" value = "(built-in)" if node == "" else node return _run(lambda: _get_json(f"computer/{safe_segment(value, 'node')}")) - Helper that validates and URL-encodes a single path segment to prevent traversal or empty segments.
def safe_segment(value: str, label: str) -> str: if not value or value in {".", ".."} or "/" in value: raise PathValidationError(f"{label} must be a single Jenkins path segment") return quote(value, safe="") - Helper that calls JenkinsClient.get_json to make a GET request and parse the JSON response.
def _get_json(path: str, params: dict[str, Any] | None = None) -> Any: with _client() as client: return client.get_json(path, params=params) def _get_text(path: str) -> str: with _client() as client: return client.get_text(path) - Helper that wraps function calls, returning success or error dictionaries.
def _run(fn): try: return _ok(fn()) except JenkinsMCPError as exc: return exc.to_dict() def _client() -> JenkinsClient: - src/jenkins_mcp_server/tools.py:367-370 (registration)The tool name 'jenkins_get_node' is listed in the READ_TOOLS list (line 368), indicating it is a read-only tool.
"jenkins_list_nodes", "jenkins_get_node", "jenkins_list_plugins", ]