Actually, the issue comes from devices that don’t have an assigned room!
I made a PR that fixes the issue:
master ← fix-mcp-server-for-devices-with-no-room
ouvert 04:01PM - 03 Nov 25 UTC
### Pull Request check-list
To ensure your Pull Request can be accepted as fa… st as possible, make sure to review and check all of these items:
- [x] If your changes affects code, did your write the tests?
- [x] Are tests passing? (`npm test` on both front/server)
- [x] Is the linter passing? (`npm run eslint` on both front/server)
- [x] Did you run prettier? (`npm run prettier` on both front/server)
- [x] If you are adding a new features/services, did you run integration comparator? (`npm run compare-translations` on front)
- [x] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community ([french forum](https://community.gladysassistant.com/)/[english forum](https://en-community.gladysassistant.com/)) for testing before merging.
- [x] If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
- [x] If you are adding a new features/services which needs explanation, did you modify the user documentation? See [the GitHub repo](https://github.com/GladysAssistant/v4-website) and the [website](https://gladysassistant.com).
- [x] Did you add fake requests data for the demo mode (`front/src/config/demo.js`) so that the demo website is working without a backend? (if needed) See [https://demo.gladysassistant.com](https://demo.gladysassistant.com).
NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
### Description of change
Fix error:
```
2025-11-03T15:04:03+0100 <warn> service.start.js:44 (Service.start) Unable to start service mcp TypeError: Cannot read properties of null (reading 'selector')
at /src/server/services/mcp/lib/buildSchemas.js:41:28
at Array.forEach (<anonymous>)
at MCPHandler.getAllResources (/src/server/services/mcp/lib/buildSchemas.js:28:17)
at MCPHandler.createServer (/src/server/services/mcp/lib/createServer.js:26:4)
at Object.start (/src/server/services/mcp/index.js:29:5)
at Service.start (/src/server/lib/service/service.start.js:33:7)
```
Gladys v4.65.1 in build in progress with the fix…
Ah, I didn’t know we could have devices without an associated room.
Thanks for your quick fix, I didn’t have time to see the message. From what I saw you removed those devices without a room from the MCP schema. We could possibly take these devices into account by assigning them a default room « cross-room » or something like that (only in the MCP schema), what do you think? I imagine that for those who use it, it would be interesting to have, for example, the Linky in the data
By default, devices don’t have any parts, so it’s pretty common
I did a quick fix, basically to create a default part!
I’m currently adding a new tool to the MCP service. The goal is to retrieve a history of values and not just the current state. Once the list of data is obtained, we can use the power of LLMs to study the evolution, compare…
As with the graphs, you can retrieve the last hour, the last 12 hours, the last day, the last week, the last month, the last 3 months or the last year.
Short demo
VIDEO
The PR
master ← bertrandda:feat/mcp-history
opened 09:05PM - 17 Nov 25 UTC
### Pull Request check-list
To ensure your Pull Request can be accepted as fa… st as possible, make sure to review and check all of these items:
- [ ] If your changes affects code, did your write the tests?
- [ ] Are tests passing? (`npm test` on both front/server)
- [ ] Is the linter passing? (`npm run eslint` on both front/server)
- [ ] Did you run prettier? (`npm run prettier` on both front/server)
- [ ] If you are adding a new features/services, did you run integration comparator? (`npm run compare-translations` on front)
- [ ] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community ([forum](https://community.gladysassistant.com/)) for testing before merging.
- [ ] If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
- [ ] If you are adding a new features/services which needs explanation, did you modify the user documentation? See [the GitHub repo](https://github.com/GladysAssistant/v4-website) and the [website](https://gladysassistant.com).
- [ ] Did you add fake requests data for the demo mode (`front/src/config/demo.js`) so that the demo website is working without a backend? (if needed) See [https://demo.gladysassistant.com](https://demo.gladysassistant.com).
NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
### Description of change
I added new tool to retrieve feature value history
I also try [toon](https://github.com/toon-format/toon) as response encoding to reduce token used by llm
As with the first time, an image is available bertrandda/gladys:mcp-server
2 Likes
A new image is available with some fixes.
@pierre-gilles I think we’re good to start the review
1 Like
Looks good to me, it’s merged and it’ll be included in the next Gladys release
2 Likes