MCP: improve tool naming, add docs (#22862)
This commit is contained in:
parent
7990146bb3
commit
40453bba20
7 changed files with 1156 additions and 44 deletions
4
go.mod
4
go.mod
|
|
@ -33,7 +33,7 @@ require (
|
|||
github.com/enbility/eebus-go v0.7.0
|
||||
github.com/enbility/ship-go v0.6.0
|
||||
github.com/enbility/spine-go v0.7.0
|
||||
github.com/evcc-io/openapi-mcp v0.3.2-0.20250810085124-11eaedf32359
|
||||
github.com/evcc-io/openapi-mcp v0.4.0
|
||||
github.com/evcc-io/rct v0.1.2-0.20250315164247-d2f41b161785
|
||||
github.com/evcc-io/tesla-proxy-client v0.0.0-20240221194046-4168b3759701
|
||||
github.com/fatih/structs v1.1.0
|
||||
|
|
@ -230,6 +230,7 @@ require (
|
|||
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
|
||||
gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/mod v0.26.0 // indirect
|
||||
golang.org/x/sys v0.34.0 // indirect
|
||||
golang.org/x/term v0.33.0 // indirect
|
||||
|
|
@ -247,6 +248,7 @@ tool (
|
|||
github.com/dmarkham/enumer
|
||||
github.com/evcc-io/evcc/cmd/decorate
|
||||
github.com/evcc-io/evcc/cmd/openapi
|
||||
github.com/evcc-io/openapi-mcp/cmd/openapi-mcp
|
||||
github.com/gokrazy/tools/cmd/gok
|
||||
go.uber.org/mock/mockgen
|
||||
)
|
||||
|
|
|
|||
6
go.sum
6
go.sum
|
|
@ -185,8 +185,8 @@ github.com/evcc-io/modbus v0.0.0-20250501165638-8b6f1fbdb7ea h1:F6eyC8V8wvc3ranl
|
|||
github.com/evcc-io/modbus v0.0.0-20250501165638-8b6f1fbdb7ea/go.mod h1:swrNGAVgI1r/3d/sEKE7qgujdRR9aHVPYKyc3gvpVTc=
|
||||
github.com/evcc-io/ocpp-go v0.0.0-20250322092544-c0c6094051c0 h1:Qz34Pm1Wr05jjJia5g2On3zRqdZh+BLTwqHgJGsiIh4=
|
||||
github.com/evcc-io/ocpp-go v0.0.0-20250322092544-c0c6094051c0/go.mod h1:2kcukDdhui4u730VfnYVWuwzDLgw+mBRGDir/QAyBhg=
|
||||
github.com/evcc-io/openapi-mcp v0.3.2-0.20250810085124-11eaedf32359 h1:VrNkGZmSfBDKuAeFbg/Vz3oDN9z1Q3XQ4vS415Jr6Jw=
|
||||
github.com/evcc-io/openapi-mcp v0.3.2-0.20250810085124-11eaedf32359/go.mod h1:87GSlXX1DP8ne5ELpm18vst5yiMmDFeSRG8xYL1BfzQ=
|
||||
github.com/evcc-io/openapi-mcp v0.4.0 h1:tgzGsuBWj1aInD6hBbaShHHYUlul61QgGUeBC/nxNk0=
|
||||
github.com/evcc-io/openapi-mcp v0.4.0/go.mod h1:87GSlXX1DP8ne5ELpm18vst5yiMmDFeSRG8xYL1BfzQ=
|
||||
github.com/evcc-io/rct v0.1.2-0.20250315164247-d2f41b161785 h1:OWCBVMcPsVTffdiZN3VYaq9p4fsWlzd490J6pekaKLA=
|
||||
github.com/evcc-io/rct v0.1.2-0.20250315164247-d2f41b161785/go.mod h1:n6MTBU36QOadGlxxiADu86VaT5l0eYdbmFBHF14AD/s=
|
||||
github.com/evcc-io/tesla-proxy-client v0.0.0-20240221194046-4168b3759701 h1:3JplY3KS6KMDVDNAU+3+KWmSWmoHIU34qwuIpW6SiHk=
|
||||
|
|
@ -793,6 +793,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8
|
|||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
||||
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
|
||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||
go.yaml.in/yaml/v4 v4.0.0-20250730171608-926dd0b54a90 h1:PK8906uEqvjB6qgonTahH/ZBqrdIv/6mpysTotKxvL0=
|
||||
go.yaml.in/yaml/v4 v4.0.0-20250730171608-926dd0b54a90/go.mod h1:CBdeces52/nUXndfQ5OY8GEQuNR9uEEOJPZj/Xq5IzU=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/evcc-io/evcc/util"
|
||||
openapi2mcp "github.com/evcc-io/openapi-mcp"
|
||||
|
|
@ -42,13 +40,12 @@ func NewHandler(host http.Handler, baseUrl, basePath string) (http.Handler, erro
|
|||
srv := mcp.NewServer(&mcp.Implementation{Name: "evcc", Version: util.Version}, nil)
|
||||
|
||||
openapi2mcp.RegisterOpenAPITools(srv, ops, doc, &openapi2mcp.ToolGenOptions{
|
||||
NameFormat: nameFormat(log),
|
||||
TagFilter: []string{
|
||||
"general",
|
||||
"battery",
|
||||
"loadpoints",
|
||||
"tariffs",
|
||||
"loadpoints",
|
||||
"vehicles",
|
||||
"battery",
|
||||
},
|
||||
RequestHandler: requestHandler(host),
|
||||
})
|
||||
|
|
@ -75,32 +72,6 @@ func NewHandler(host http.Handler, baseUrl, basePath string) (http.Handler, erro
|
|||
return handler, nil
|
||||
}
|
||||
|
||||
func nameFormat(log *util.Logger) func(name string) string {
|
||||
return func(name string) string {
|
||||
// move method to the end
|
||||
parts := strings.SplitN(name, "_", 2)
|
||||
slices.Reverse(parts)
|
||||
|
||||
res := strings.Join(parts, "-")
|
||||
res = strings.ReplaceAll(res, "/", "-")
|
||||
res = strings.ReplaceAll(res, "{", "_")
|
||||
res = strings.ReplaceAll(res, "}", "")
|
||||
res = strings.ReplaceAll(res, "-_", "_")
|
||||
res = strings.ReplaceAll(res, "--", "-")
|
||||
|
||||
res = strings.TrimLeft(res, "/-_")
|
||||
res = strings.ToLower(res)
|
||||
|
||||
// Claude Code has a 64 character limit for tool names
|
||||
if len(res) > 64 {
|
||||
res = res[:64]
|
||||
}
|
||||
|
||||
log.TRACE.Println("adding tool:", res)
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
func requestHandler(handler http.Handler) func(req *http.Request) (*http.Response, error) {
|
||||
return func(req *http.Request) (*http.Response, error) {
|
||||
w := httptest.NewRecorder()
|
||||
|
|
|
|||
|
|
@ -717,7 +717,7 @@
|
|||
"title": "evcc",
|
||||
"version": "0.2.0"
|
||||
},
|
||||
"openapi": "3.0.3",
|
||||
"openapi": "3.1.0",
|
||||
"paths": {
|
||||
"/auth/login": {
|
||||
"post": {
|
||||
|
|
@ -790,6 +790,7 @@
|
|||
"/auth/password": {
|
||||
"put": {
|
||||
"description": "Changes the admin password.",
|
||||
"operationId": "changePassword",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
|
|
@ -817,6 +818,7 @@
|
|||
"/auth/status": {
|
||||
"get": {
|
||||
"description": "Whether the current user is logged in.",
|
||||
"operationId": "getAuthStatus",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
|
|
@ -845,6 +847,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/battery"
|
||||
},
|
||||
"operationId": "setBatteryDischargeControl",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/enable"
|
||||
|
|
@ -867,6 +870,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/battery"
|
||||
},
|
||||
"operationId": "removeBatteryGridChargeLimit",
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/NullResult"
|
||||
|
|
@ -884,6 +888,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/battery"
|
||||
},
|
||||
"operationId": "setBatteryGridChargeLimit",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/costLimit"
|
||||
|
|
@ -903,6 +908,7 @@
|
|||
"/batterymode": {
|
||||
"delete": {
|
||||
"description": "Default evcc control behavior is restored",
|
||||
"operationId": "disableExternalBatteryControl",
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/BatteryModeResult"
|
||||
|
|
@ -917,6 +923,7 @@
|
|||
"/batterymode/{batteryMode}": {
|
||||
"post": {
|
||||
"description": "Directly controls the mode of all controllable batteries. evcc behavior like 'price limit' or 'prevent discharge while fast charging' is overruled. External mode resets after 60s. The external system has to call this endpoint regularly.",
|
||||
"operationId": "setExternalBatteryMode",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/batteryMode"
|
||||
|
|
@ -939,6 +946,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/battery"
|
||||
},
|
||||
"operationId": "setBufferSoc",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/soc"
|
||||
|
|
@ -961,6 +969,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/battery"
|
||||
},
|
||||
"operationId": "setBufferStartSoc",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/soc"
|
||||
|
|
@ -1006,6 +1015,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/battery#battery-boost"
|
||||
},
|
||||
"operationId": "setLoadpointBatteryBoost",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1031,6 +1041,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/loadpoints"
|
||||
},
|
||||
"operationId": "setLoadpointDisableDelay",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1056,6 +1067,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/loadpoints#threshold-1"
|
||||
},
|
||||
"operationId": "setLoadpointDisableThreshold",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1081,6 +1093,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/loadpoints#delay"
|
||||
},
|
||||
"operationId": "setLoadpointEnableDelay",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1106,6 +1119,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/loadpoints#threshold"
|
||||
},
|
||||
"operationId": "setLoadpointEnableThreshold",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1131,6 +1145,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/limit"
|
||||
},
|
||||
"operationId": "setLoadpointEnergyLimit",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1156,6 +1171,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/limit"
|
||||
},
|
||||
"operationId": "setLoadpointSocLimit",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1178,6 +1194,7 @@
|
|||
"/loadpoints/{id}/maxcurrent/{current}": {
|
||||
"post": {
|
||||
"description": "Updates the maximum current of the loadpoint.",
|
||||
"operationId": "setLoadpointMaxCurrent",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1200,6 +1217,7 @@
|
|||
"/loadpoints/{id}/mincurrent/{current}": {
|
||||
"post": {
|
||||
"description": "Updates the minimum current of the loadpoint.",
|
||||
"operationId": "setLoadpointMinCurrent",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1225,6 +1243,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/solar-charging"
|
||||
},
|
||||
"operationId": "setLoadpointMode",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1262,6 +1281,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/loadpoints#phases"
|
||||
},
|
||||
"operationId": "setLoadpointPhases",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1290,6 +1310,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "getLoadpointPlan",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1327,7 +1348,7 @@
|
|||
"description": "Success"
|
||||
}
|
||||
},
|
||||
"summary": "Plan rates",
|
||||
"summary": "Get charging plan",
|
||||
"tags": [
|
||||
"loadpoints"
|
||||
]
|
||||
|
|
@ -1339,6 +1360,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "deleteLoadpointEnergyPlan",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1361,6 +1383,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "setLoadpointEnergyPlan",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1401,6 +1424,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "previewLoadpointRepeatingPlan",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1435,6 +1459,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "previewLoadpointEnergyPlan",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1463,6 +1488,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "previewLoadpointSocPlan",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1491,6 +1517,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/loadpoints#priority"
|
||||
},
|
||||
"operationId": "setLoadpointPriority",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1524,6 +1551,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/dynamic-prices"
|
||||
},
|
||||
"operationId": "deleteLoadpointSmartCostLimit",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1546,6 +1574,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/dynamic-prices"
|
||||
},
|
||||
"operationId": "setLoadpointSmartCostLimit",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1571,6 +1600,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/vehicle"
|
||||
},
|
||||
"operationId": "removeLoadpointVehicle",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1591,6 +1621,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/vehicle"
|
||||
},
|
||||
"operationId": "startLoadpointVehicleDetection",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1613,6 +1644,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/vehicle"
|
||||
},
|
||||
"operationId": "assignLoadpointVehicle",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/id"
|
||||
|
|
@ -1655,6 +1687,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/battery"
|
||||
},
|
||||
"operationId": "setPrioritySoc",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/soc"
|
||||
|
|
@ -1677,6 +1710,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/site#residualpower"
|
||||
},
|
||||
"operationId": "setResidualPower",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/power"
|
||||
|
|
@ -1699,6 +1733,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/sessions"
|
||||
},
|
||||
"operationId": "deleteSession",
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/NullResult"
|
||||
|
|
@ -1719,6 +1754,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/sessions"
|
||||
},
|
||||
"operationId": "updateSession",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
|
|
@ -1754,6 +1790,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/sessions"
|
||||
},
|
||||
"operationId": "getSessions",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Response format (default json)",
|
||||
|
|
@ -1832,6 +1869,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/telemetry"
|
||||
},
|
||||
"operationId": "getTelemetryStatus",
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/BooleanResult"
|
||||
|
|
@ -1849,6 +1887,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/telemetry"
|
||||
},
|
||||
"operationId": "setTelemetryStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/enable"
|
||||
|
|
@ -1871,6 +1910,7 @@
|
|||
"/smartcostlimit": {
|
||||
"delete": {
|
||||
"description": "Convenience method to remove limit for all loadpoints at once. Value is applied to each individual loadpoint.",
|
||||
"operationId": "removeGlobalSmartCostLimit",
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/components/responses/NullResult"
|
||||
|
|
@ -1878,13 +1918,14 @@
|
|||
},
|
||||
"summary": "Remove smart charging cost limit for all loadpoints.",
|
||||
"tags": [
|
||||
"loadpoints"
|
||||
"general"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/smartcostlimit/{cost}": {
|
||||
"post": {
|
||||
"description": "Conveniance method to set smart charging cost limit for all loadpoints at once. Value is applied to each individual loadpoint.",
|
||||
"description": "Convenience method to set smart charging cost limit for all loadpoints at once. Value is applied to each individual loadpoint.",
|
||||
"operationId": "setGlobalSmartCostLimit",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/costLimit"
|
||||
|
|
@ -1897,7 +1938,7 @@
|
|||
},
|
||||
"summary": "Set smart charging cost limit for all loadpoints",
|
||||
"tags": [
|
||||
"loadpoints"
|
||||
"general"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -1957,6 +1998,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/reference/configuration/log"
|
||||
},
|
||||
"operationId": "getSystemLogs",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/logAreas"
|
||||
|
|
@ -2029,6 +2071,7 @@
|
|||
"/system/log/areas": {
|
||||
"get": {
|
||||
"description": "Returns a list of all log areas (e.g. `lp-1`, `site`, `db`).",
|
||||
"operationId": "getLogAreas",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
|
|
@ -2063,6 +2106,7 @@
|
|||
"/system/shutdown": {
|
||||
"post": {
|
||||
"description": "Shut down instance. There is no reboot command. We expect the underlying system (docker, systemd, etc.) to restart the evcc instance once it's terminated.",
|
||||
"operationId": "shutdownSystem",
|
||||
"responses": {
|
||||
"204": {
|
||||
"$ref": "#/components/responses/BlankResponse"
|
||||
|
|
@ -2088,6 +2132,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/devices/tariffs"
|
||||
},
|
||||
"operationId": "getTariffInfo",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Tariff type",
|
||||
|
|
@ -2143,6 +2188,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/limits"
|
||||
},
|
||||
"operationId": "setVehicleSocLimit",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/vehicleName"
|
||||
|
|
@ -2168,6 +2214,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/limits"
|
||||
},
|
||||
"operationId": "setVehicleMinSoc",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/vehicleName"
|
||||
|
|
@ -2193,6 +2240,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "updateVehicleRepeatingPlans",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/vehicleName"
|
||||
|
|
@ -2237,6 +2285,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "deleteVehicleSocPlan",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/vehicleName"
|
||||
|
|
@ -2259,6 +2308,7 @@
|
|||
"externalDocs": {
|
||||
"url": "https://docs.evcc.io/en/docs/features/plans"
|
||||
},
|
||||
"operationId": "setVehicleSocPlan",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/vehicleName"
|
||||
|
|
|
|||
1036
server/mcp/openapi.md
Normal file
1036
server/mcp/openapi.md
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,3 +1,4 @@
|
|||
package server
|
||||
|
||||
//go:generate go tool openapi openapi.yaml mcp/openapi.json
|
||||
//go:generate go tool openapi-mcp --doc mcp/openapi.md openapi.yaml
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
openapi: 3.0.3
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: evcc
|
||||
description: Solar charging. Super simple.
|
||||
|
|
@ -65,6 +65,7 @@ paths:
|
|||
- auth=; Path=/; HttpOnly
|
||||
/auth/password:
|
||||
put:
|
||||
operationId: changePassword
|
||||
summary: Change admin password
|
||||
description: "Changes the admin password."
|
||||
tags:
|
||||
|
|
@ -82,6 +83,7 @@ paths:
|
|||
description: Invalid password provided
|
||||
/auth/status:
|
||||
get:
|
||||
operationId: getAuthStatus
|
||||
summary: Authentication status
|
||||
description: Whether the current user is logged in.
|
||||
tags:
|
||||
|
|
@ -98,6 +100,7 @@ paths:
|
|||
- "false"
|
||||
/batterydischargecontrol/{enable}:
|
||||
post:
|
||||
operationId: setBatteryDischargeControl
|
||||
summary: Control battery-discharge
|
||||
description: "Prevent home battery discharge during vehicle fast charging."
|
||||
externalDocs:
|
||||
|
|
@ -111,6 +114,7 @@ paths:
|
|||
$ref: "#/components/responses/BooleanResult"
|
||||
/batterygridchargelimit:
|
||||
delete:
|
||||
operationId: removeBatteryGridChargeLimit
|
||||
summary: Remove battery grid charge limit
|
||||
description: "Remove battery grid charge limit."
|
||||
externalDocs:
|
||||
|
|
@ -122,6 +126,7 @@ paths:
|
|||
$ref: "#/components/responses/NullResult"
|
||||
/batterygridchargelimit/{cost}:
|
||||
post:
|
||||
operationId: setBatteryGridChargeLimit
|
||||
summary: Set battery grid charge limit
|
||||
description: "Charge home battery from grid when price or emissions are below the threshold. Uses price if a dynamic tariff exists. Uses emissions if a CO₂-tariff is configured. Ignored otherwise."
|
||||
externalDocs:
|
||||
|
|
@ -135,6 +140,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/batterymode:
|
||||
delete:
|
||||
operationId: disableExternalBatteryControl
|
||||
summary: Disable external battery control
|
||||
description: Default evcc control behavior is restored
|
||||
tags:
|
||||
|
|
@ -144,6 +150,7 @@ paths:
|
|||
$ref: "#/components/responses/BatteryModeResult"
|
||||
/batterymode/{batteryMode}:
|
||||
post:
|
||||
operationId: setExternalBatteryMode
|
||||
summary: Set external battery mode
|
||||
description: "Directly controls the mode of all controllable batteries. evcc behavior like 'price limit' or 'prevent discharge while fast charging' is overruled. External mode resets after 60s. The external system has to call this endpoint regularly."
|
||||
tags:
|
||||
|
|
@ -155,6 +162,7 @@ paths:
|
|||
$ref: "#/components/responses/BatteryModeResult"
|
||||
/buffersoc/{soc}:
|
||||
post:
|
||||
operationId: setBufferSoc
|
||||
summary: Set battery buffer SoC
|
||||
description: "Set battery buffer SoC."
|
||||
externalDocs:
|
||||
|
|
@ -168,6 +176,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/bufferstartsoc/{soc}:
|
||||
post:
|
||||
operationId: setBufferStartSoc
|
||||
summary: Set battery buffer start SoC
|
||||
description: "Set battery buffer start SoC."
|
||||
externalDocs:
|
||||
|
|
@ -196,6 +205,7 @@ paths:
|
|||
example: OK
|
||||
/loadpoints/{id}/batteryboost/{enable}:
|
||||
post:
|
||||
operationId: setLoadpointBatteryBoost
|
||||
summary: Set battery boost
|
||||
description: "Enable or disable battery boost."
|
||||
externalDocs:
|
||||
|
|
@ -210,6 +220,7 @@ paths:
|
|||
$ref: "#/components/responses/BooleanResult"
|
||||
/loadpoints/{id}/disable/delay/{delay}:
|
||||
post:
|
||||
operationId: setLoadpointDisableDelay
|
||||
summary: Disable threshold-delay
|
||||
description: "Delay before charging stops in solar mode."
|
||||
externalDocs:
|
||||
|
|
@ -224,6 +235,7 @@ paths:
|
|||
$ref: "#/components/responses/NanoSecondsResult"
|
||||
/loadpoints/{id}/disable/threshold/{threshold}:
|
||||
post:
|
||||
operationId: setLoadpointDisableThreshold
|
||||
summary: Disable threshold
|
||||
description: "Specifies the grid draw power to stop charging in solar mode."
|
||||
externalDocs:
|
||||
|
|
@ -238,6 +250,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/loadpoints/{id}/enable/delay/{delay}:
|
||||
post:
|
||||
operationId: setLoadpointEnableDelay
|
||||
summary: Enable threshold-delay
|
||||
description: "Delay before charging starts in solar mode."
|
||||
externalDocs:
|
||||
|
|
@ -252,6 +265,7 @@ paths:
|
|||
$ref: "#/components/responses/NanoSecondsResult"
|
||||
/loadpoints/{id}/enable/threshold/{threshold}:
|
||||
post:
|
||||
operationId: setLoadpointEnableThreshold
|
||||
summary: Enable threshold
|
||||
description: "Specifies the available surplus power to start charging in solar mode."
|
||||
externalDocs:
|
||||
|
|
@ -266,6 +280,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/loadpoints/{id}/limitenergy/{energy}:
|
||||
post:
|
||||
operationId: setLoadpointEnergyLimit
|
||||
summary: Update energy limit
|
||||
description: "Updates the energy limit of the loadpoint. Only available for guest vehicles and vehicles with unknown SoC. Limit is removed on vehicle disconnect."
|
||||
externalDocs:
|
||||
|
|
@ -280,6 +295,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/loadpoints/{id}/limitsoc/{soc}:
|
||||
post:
|
||||
operationId: setLoadpointSocLimit
|
||||
summary: Update limit SoC
|
||||
description: "Updates the SoC limit of the loadpoint. Requires a connected vehicle with known SoC. Limit is maintained across charging sessions."
|
||||
externalDocs:
|
||||
|
|
@ -294,6 +310,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/loadpoints/{id}/maxcurrent/{current}:
|
||||
post:
|
||||
operationId: setLoadpointMaxCurrent
|
||||
summary: Update maximum current
|
||||
description: "Updates the maximum current of the loadpoint."
|
||||
tags:
|
||||
|
|
@ -306,6 +323,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/loadpoints/{id}/mincurrent/{current}:
|
||||
post:
|
||||
operationId: setLoadpointMinCurrent
|
||||
summary: Update minimum current
|
||||
description: "Updates the minimum current of the loadpoint."
|
||||
tags:
|
||||
|
|
@ -318,6 +336,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/loadpoints/{id}/mode/{mode}:
|
||||
post:
|
||||
operationId: setLoadpointMode
|
||||
summary: Update charge mode
|
||||
description: "Changes the charging behavior of the loadpoint."
|
||||
externalDocs:
|
||||
|
|
@ -339,6 +358,7 @@ paths:
|
|||
$ref: "#/components/schemas/Mode"
|
||||
/loadpoints/{id}/phases/{phases}:
|
||||
post:
|
||||
operationId: setLoadpointPhases
|
||||
summary: Update allowed phases
|
||||
description: "Updates the allowed phases of the loadpoint. Selects the desired phase mode for chargers with automatic phase switching. For manual phase switching chargers (via cable or Lasttrennschalter) this value tells evcc the actual phases."
|
||||
externalDocs:
|
||||
|
|
@ -355,7 +375,8 @@ paths:
|
|||
description: "Invalid phases-value. You have most likely entered the value 0 for a wallbox that cannot switch phases automatically."
|
||||
/loadpoints/{id}/plan:
|
||||
get:
|
||||
summary: Plan rates
|
||||
operationId: getLoadpointPlan
|
||||
summary: Get charging plan
|
||||
description: "Returns the current charging plan for this loadpoint."
|
||||
externalDocs:
|
||||
url: https://docs.evcc.io/en/docs/features/plans
|
||||
|
|
@ -382,6 +403,7 @@ paths:
|
|||
- $ref: "#/components/schemas/PlanRates"
|
||||
/loadpoints/{id}/plan/energy:
|
||||
delete:
|
||||
operationId: deleteLoadpointEnergyPlan
|
||||
summary: Delete energy-based charging plan
|
||||
description: "Delete charging plan. Only available when a vehicle without SoC is connected."
|
||||
externalDocs:
|
||||
|
|
@ -395,6 +417,7 @@ paths:
|
|||
$ref: "#/components/responses/EmptyResult"
|
||||
/loadpoints/{id}/plan/energy/{energy}/{timestamp}:
|
||||
post:
|
||||
operationId: setLoadpointEnergyPlan
|
||||
summary: Set energy-based charging plan
|
||||
description: "Create charging plan with fixed time and energy target. Only available when a vehicle without SoC is connected."
|
||||
externalDocs:
|
||||
|
|
@ -417,6 +440,7 @@ paths:
|
|||
$ref: "#/components/schemas/StaticEnergyPlan"
|
||||
/loadpoints/{id}/plan/repeating/preview/{soc}/{weekdays}/{hourMinuteTime}/{timezone}:
|
||||
get:
|
||||
operationId: previewLoadpointRepeatingPlan
|
||||
summary: Repeating plan preview
|
||||
description: "Simulate repeating charging plan and return the result. Does not alter the actual charging plan."
|
||||
externalDocs:
|
||||
|
|
@ -434,6 +458,7 @@ paths:
|
|||
$ref: "#/components/responses/PlanRatesResult"
|
||||
/loadpoints/{id}/plan/static/preview/soc/{soc}/{timestamp}:
|
||||
get:
|
||||
operationId: previewLoadpointSocPlan
|
||||
summary: Simulate soc-based charging plan
|
||||
description: "Simulate charging plan based on SoC goal. Does not alter the actual charging plan."
|
||||
externalDocs:
|
||||
|
|
@ -449,6 +474,7 @@ paths:
|
|||
$ref: "#/components/responses/PlanRatesResult"
|
||||
/loadpoints/{id}/plan/static/preview/energy/{energy}/{timestamp}:
|
||||
get:
|
||||
operationId: previewLoadpointEnergyPlan
|
||||
summary: Simulate energy-based charging plan
|
||||
description: "Simulate charging plan based on energy goal. Does not alter the actual charging plan."
|
||||
externalDocs:
|
||||
|
|
@ -464,6 +490,7 @@ paths:
|
|||
$ref: "#/components/responses/PlanRatesResult"
|
||||
/loadpoints/{id}/priority/{priority}:
|
||||
post:
|
||||
operationId: setLoadpointPriority
|
||||
summary: Set priority
|
||||
description: "Set loadpoint priority."
|
||||
externalDocs:
|
||||
|
|
@ -485,6 +512,7 @@ paths:
|
|||
$ref: "#/components/responses/IntegerResult"
|
||||
/loadpoints/{id}/smartcostlimit:
|
||||
delete:
|
||||
operationId: deleteLoadpointSmartCostLimit
|
||||
summary: Delete smart charging cost limit
|
||||
description: "Delete cost or emission limit for fast-charging with grid energy."
|
||||
externalDocs:
|
||||
|
|
@ -498,6 +526,7 @@ paths:
|
|||
$ref: "#/components/responses/NullResult"
|
||||
/loadpoints/{id}/smartcostlimit/{cost}:
|
||||
post:
|
||||
operationId: setLoadpointSmartCostLimit
|
||||
summary: Set smart charging cost limit
|
||||
description: "Set cost or emission limit for fast-charging with grid energy."
|
||||
externalDocs:
|
||||
|
|
@ -512,6 +541,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/loadpoints/{id}/vehicle:
|
||||
delete:
|
||||
operationId: removeLoadpointVehicle
|
||||
summary: Remove vehicle
|
||||
description: "Remove vehicle from loadpoint. Connected vehicle is treated as guest vehicle."
|
||||
externalDocs:
|
||||
|
|
@ -524,6 +554,7 @@ paths:
|
|||
200:
|
||||
$ref: "#/components/responses/EmptyResult"
|
||||
patch:
|
||||
operationId: startLoadpointVehicleDetection
|
||||
summary: Start vehicle detection
|
||||
description: "Starts the automatic vehicle detection process."
|
||||
externalDocs:
|
||||
|
|
@ -537,6 +568,7 @@ paths:
|
|||
$ref: "#/components/responses/EmptyResult"
|
||||
/loadpoints/{id}/vehicle/{name}:
|
||||
post:
|
||||
operationId: assignLoadpointVehicle
|
||||
summary: Assign vehicle
|
||||
description: "Assigns vehicle to loadpoint."
|
||||
externalDocs:
|
||||
|
|
@ -561,6 +593,7 @@ paths:
|
|||
$ref: "#/components/schemas/VehicleTitle"
|
||||
/prioritysoc/{soc}:
|
||||
post:
|
||||
operationId: setPrioritySoc
|
||||
summary: Set battery priority SoC
|
||||
description: "Set battery priority SoC."
|
||||
externalDocs:
|
||||
|
|
@ -574,6 +607,7 @@ paths:
|
|||
$ref: "#/components/responses/NumberResult"
|
||||
/residualpower/{power}:
|
||||
post:
|
||||
operationId: setResidualPower
|
||||
summary: Set grid residual power
|
||||
description: "Set grid connection operating point."
|
||||
externalDocs:
|
||||
|
|
@ -589,6 +623,7 @@ paths:
|
|||
parameters:
|
||||
- $ref: "#/components/parameters/id"
|
||||
put:
|
||||
operationId: updateSession
|
||||
summary: Update vehicle of charging session
|
||||
description: "Update vehicle of charging session."
|
||||
externalDocs:
|
||||
|
|
@ -610,6 +645,7 @@ paths:
|
|||
200:
|
||||
description: Success
|
||||
delete:
|
||||
operationId: deleteSession
|
||||
summary: Delete charging session
|
||||
description: "Delete charging session."
|
||||
externalDocs:
|
||||
|
|
@ -621,6 +657,7 @@ paths:
|
|||
$ref: "#/components/responses/NullResult"
|
||||
/sessions:
|
||||
get:
|
||||
operationId: getSessions
|
||||
summary: Charging sessions
|
||||
description: "Returns a list of charging sessions."
|
||||
externalDocs:
|
||||
|
|
@ -672,6 +709,7 @@ paths:
|
|||
format: binary
|
||||
/settings/telemetry:
|
||||
get:
|
||||
operationId: getTelemetryStatus
|
||||
summary: Telemetry status
|
||||
description: "Returns the current telemetry status."
|
||||
externalDocs:
|
||||
|
|
@ -683,6 +721,7 @@ paths:
|
|||
$ref: "#/components/responses/BooleanResult"
|
||||
/settings/telemetry/{enable}:
|
||||
post:
|
||||
operationId: setTelemetryStatus
|
||||
summary: Enable/disable telemetry
|
||||
description: "Enable or disable telemetry. Note: Telemetry requires sponsorship."
|
||||
externalDocs:
|
||||
|
|
@ -698,19 +737,21 @@ paths:
|
|||
description: Sponsorship required
|
||||
/smartcostlimit:
|
||||
delete:
|
||||
operationId: removeGlobalSmartCostLimit
|
||||
summary: Remove smart charging cost limit for all loadpoints.
|
||||
description: "Convenience method to remove limit for all loadpoints at once. Value is applied to each individual loadpoint."
|
||||
tags:
|
||||
- loadpoints
|
||||
- general
|
||||
responses:
|
||||
200:
|
||||
$ref: "#/components/responses/NullResult"
|
||||
/smartcostlimit/{cost}:
|
||||
post:
|
||||
operationId: setGlobalSmartCostLimit
|
||||
summary: Set smart charging cost limit for all loadpoints
|
||||
description: "Conveniance method to set smart charging cost limit for all loadpoints at once. Value is applied to each individual loadpoint."
|
||||
description: "Convenience method to set smart charging cost limit for all loadpoints at once. Value is applied to each individual loadpoint."
|
||||
tags:
|
||||
- loadpoints
|
||||
- general
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/costLimit"
|
||||
responses:
|
||||
|
|
@ -750,6 +791,7 @@ paths:
|
|||
$ref: "#/components/schemas/State"
|
||||
/system/log:
|
||||
get:
|
||||
operationId: getSystemLogs
|
||||
summary: Logs
|
||||
description: "Returns the latest log lines."
|
||||
externalDocs:
|
||||
|
|
@ -795,6 +837,7 @@ paths:
|
|||
$ref: "#/components/responses/Unauthorized"
|
||||
/system/log/areas:
|
||||
get:
|
||||
operationId: getLogAreas
|
||||
summary: List of all log areas
|
||||
description: "Returns a list of all log areas (e.g. `lp-1`, `site`, `db`)."
|
||||
security:
|
||||
|
|
@ -815,6 +858,7 @@ paths:
|
|||
$ref: "#/components/responses/Unauthorized"
|
||||
/system/shutdown:
|
||||
post:
|
||||
operationId: shutdownSystem
|
||||
summary: Shutdown evcc
|
||||
description: "Shut down instance. There is no reboot command. We expect the underlying system (docker, systemd, etc.) to restart the evcc instance once it's terminated."
|
||||
security:
|
||||
|
|
@ -828,6 +872,7 @@ paths:
|
|||
$ref: "#/components/responses/Unauthorized"
|
||||
/tariff/{type}:
|
||||
get:
|
||||
operationId: getTariffInfo
|
||||
summary: Tariff information
|
||||
description: "Returns the prices or emission values for the upcoming hours"
|
||||
externalDocs:
|
||||
|
|
@ -864,6 +909,7 @@ paths:
|
|||
description: Tariff not defined
|
||||
/vehicles/{name}/limitsoc/{soc}:
|
||||
post:
|
||||
operationId: setVehicleSocLimit
|
||||
summary: Set SoC limit
|
||||
description: "Charging will stop when this SoC is reached."
|
||||
externalDocs:
|
||||
|
|
@ -878,6 +924,7 @@ paths:
|
|||
$ref: "#/components/responses/SocResult"
|
||||
/vehicles/{name}/minsoc/{soc}:
|
||||
post:
|
||||
operationId: setVehicleMinSoc
|
||||
summary: Set minimum SoC
|
||||
description: "Vehicle will be fast-charged until this SoC is reached."
|
||||
externalDocs:
|
||||
|
|
@ -892,6 +939,7 @@ paths:
|
|||
$ref: "#/components/responses/SocResult"
|
||||
/vehicles/{name}/plan/repeating:
|
||||
post:
|
||||
operationId: updateVehicleRepeatingPlans
|
||||
summary: Update repeating plans
|
||||
description: "Updates the repeating charging plan."
|
||||
externalDocs:
|
||||
|
|
@ -918,6 +966,7 @@ paths:
|
|||
$ref: "#/components/schemas/RepeatingPlans"
|
||||
/vehicles/{name}/plan/soc:
|
||||
delete:
|
||||
operationId: deleteVehicleSocPlan
|
||||
summary: Delete a SoC-based charging plan
|
||||
description: "Delete the charging plan"
|
||||
externalDocs:
|
||||
|
|
@ -931,6 +980,7 @@ paths:
|
|||
$ref: "#/components/responses/EmptyResult"
|
||||
/vehicles/{name}/plan/soc/{soc}/{timestamp}:
|
||||
post:
|
||||
operationId: setVehicleSocPlan
|
||||
summary: Set a SoC-based charging plan
|
||||
description: "Create charging plan with fixed time and SoC target."
|
||||
externalDocs:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue