Skip to content

feat(metric): add get_service_metrics tool#215

Open
matty69v wants to merge 1 commit into
centreon:developfrom
matty69v:feat/get-service-metrics
Open

feat(metric): add get_service_metrics tool#215
matty69v wants to merge 1 commit into
centreon:developfrom
matty69v:feat/get-service-metrics

Conversation

@matty69v
Copy link
Copy Markdown
Contributor

@matty69v matty69v commented May 5, 2026

Hey team,

Continuing my contributions after #209 (force_check) and #210 (get_resource_timeline). Still dogfooding the MCP server with Claude Code against a staging Centreon.

The gap

After using list_resources to confirm a service is in WARNING or CRITICAL state, the natural follow-up is "what's the actual value?" The output string sometimes contains metrics, but it's unstructured text that the LLM has to parse heuristically. Meanwhile, the structured metric data (current value, unit, thresholds) is already available via the API but not exposed through MCP.

What this PR adds

A new get_service_metrics tool in a dedicated components/metric.py module:

async def get_service_metrics(host_id: int, service_id: int) -> list[Metric]
  • Returns all metrics for a service with their current value, unit, and warning/critical thresholds
  • Tagged readOnlyHint=True, idempotentHint=True
  • Endpoint: GET /monitoring/hosts/{host_id}/services/{service_id}/metrics (API docs)

Implementation notes

Tool count

12 → 13. README updated.

Tests

2 new tests, all passing alongside the existing suite:

  • tests/utils/test_type.py::test_metric_list
  • tests/components/test_metric.py::test_get_service_metrics
33 passed in 1.87s
ruff check .          All checks passed!
mypy centreon_mcp     Success: no issues found in 19 source files

No new dependencies, no breaking changes.

Summary by Aikido

Security Issues: 0 🔍 Quality Issues: 2 Resolved Issues: 0

🚀 New Features

  • Added get_service_metrics tool with Metric model and tests

More info

Comment thread centreon_mcp/utils/type.py
Comment thread centreon_mcp/components/metric.py
@matty69v
Copy link
Copy Markdown
Contributor Author

Hello team do we have some news from my 2 pr's ?

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.

1 participant