get_all_nodes
Retrieve a list of all Jenkins nodes to monitor build agents and manage distributed builds.
Instructions
Get all nodes from Jenkins
Returns: A list of all nodes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_jenkins/server/node.py:7-14 (handler)The actual tool handler: 'get_all_nodes' registered via @mcp.tool decorator. Calls jenkins(ctx).get_nodes(depth=0) and returns Node model dumps excluding executors.
@mcp.tool(tags=['read']) async def get_all_nodes(ctx: Context) -> list[dict]: """Get all nodes from Jenkins Returns: A list of all nodes """ return [node.model_dump(exclude={'executors'}) for node in jenkins(ctx).get_nodes(depth=0)] - src/mcp_jenkins/server/node.py:7-8 (registration)Tool registration via @mcp.tool(tags=['read']) decorator on the get_all_nodes async function.
@mcp.tool(tags=['read']) async def get_all_nodes(ctx: Context) -> list[dict]: - Jenkins.get_nodes() method that makes the REST API call to 'computer/api/json?depth={depth}' endpoint and deserializes the 'computer' field into Node objects.
def get_nodes(self, *, depth: int = 0) -> list[Node]: """Get a list of nodes connected to the Master Args: depth: The depth of the information to retrieve. Returns: A list of Node objects. """ response = self.request('GET', rest_endpoint.NODES(depth=depth)) return [Node.model_validate(node) for node in response.json()['computer']] - REST endpoint definition for NODES: 'computer/api/json?depth={depth}' used by get_nodes.
NODES = RestEndpoint('computer/api/json?depth={depth}') - Node Pydantic model with fields displayName, offline, executors. The handler excludes executors via model_dump(exclude={'executors'}).
class Node(BaseModel): displayName: str offline: bool executors: list['NodeExecutor']