Skip to content

Add 'get_network_routes' tool#404

Open
subpop wants to merge 2 commits into
rhel-lightspeed:mainfrom
subpop:add-ip-route
Open

Add 'get_network_routes' tool#404
subpop wants to merge 2 commits into
rhel-lightspeed:mainfrom
subpop:add-ip-route

Conversation

@subpop

@subpop subpop commented Apr 15, 2026

Copy link
Copy Markdown
Member

Add a fixed 'get_network_routes' tool. Inspired by the now stale #263.

@subpop subpop requested a review from a team as a code owner April 15, 2026 16:10
@github-actions

Copy link
Copy Markdown

For team members: test commit 612204f in internal GitLab

@codecov

codecov Bot commented Apr 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 97.40% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/linux_mcp_server/commands.py 89.47% <ø> (ø)
src/linux_mcp_server/models.py 100.00% <100.00%> (ø)
src/linux_mcp_server/tools/__init__.py 100.00% <100.00%> (ø)
src/linux_mcp_server/tools/network.py 100.00% <100.00%> (ø)
tests/test_server.py 99.45% <ø> (ø)
tests/tools/test_network.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexxa

alexxa commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

/retest

@alexxa

alexxa commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Functional Tests failed due to the python default issue which was fixed and merged in #396 . When rebased, it perhaps will fail again unless #407 is merged first.

@github-actions

Copy link
Copy Markdown

For team members: test commit 63f0ccd in internal GitLab

@github-actions

Copy link
Copy Markdown

For team members: test commit f022bdb in internal GitLab

@owtaylor owtaylor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are a lot of other possible tools of roughly this priority, but I don't think it hurts to go ahead and add this to the fixed toolset. It does seem to use a pattern that I think we're trying to move away from.

Comment thread src/linux_mcp_server/tools/network.py Outdated
Comment on lines +130 to +132
if is_successful_output(returncode, stdout):
routes = parse_ip_route(stdout)
return format_routes(routes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that we're trying to move away from the parse => format path - either the tool output is well understood by the model and we're only going to make it worse by parsing and reformatting it, or we parse and return it in JSON form - perhaps with an idea of supporting "code mode" programmatic use of MCP servers in the future.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I think I did the format pattern to follow the structure of the rest of network.py, since that file hasn't been converted to structured output. It didn't seem right to convert network.py to structured output as part of this PR. I can refactor get_network_routes to return structured output though, since it's a net-new tool.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #517 to convert all the network tools to structured output.

Comment thread src/linux_mcp_server/commands.py Outdated
subpop added 2 commits June 23, 2026 10:14
- Switch `ip route` to `ip -json route` for structured output
- Update Route model with validation aliases matching JSON fields
- Remove text parsing and formatting functions
- Change get_network_routes to return list[Route] instead of formatted
  string
- Raise ToolError on failure instead of returning error text
- Add "fixed" tag to indicate stable tool interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants