Refactor `diagrams` tool code to allow for more detailed node captions