Skip to content

feat(mcp): expose scheduling admin tools - #11228

Merged
mudler merged 15 commits into
mudler:masterfrom
owezzy:feat/mcp-scheduling-parity
Aug 3, 2026
Merged

feat(mcp): expose scheduling admin tools#11228
mudler merged 15 commits into
mudler:masterfrom
owezzy:feat/mcp-scheduling-parity

Conversation

@owezzy

@owezzy owezzy commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add MCP scheduling tool contracts and HTTP route/client support for distributed model scheduling
  • register list/get/set/delete scheduling tools with validation, dispatch tests, and REST route coverage
  • document scheduling tools in assistant prompts, including safety guidance and a dedicated distributed scheduling skill

Related issue

Testing

  • make protogen-go
  • go test ./pkg/mcp/localaitools/...
  • GIT_MASTER=1 git diff --check

@localai-org-maint-bot localai-org-maint-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There are two blocking issues on the current head:

  1. The in-process LocalAI Assistant cannot use the feature this PR advertises. ListScheduling always returns an empty slice and GetScheduling / SetScheduling / DeleteScheduling always return “only available in distributed mode” (pkg/mcp/localaitools/inproc/client.go). That client is exactly what the assistant initializes in Application.start; it is still used on the distributed head. Please plumb the distributed NodeRegistry into the in-process client and implement these operations directly against it, with nil/single-node behavior kept explicit. This is required by the REST↔inproc↔HTTP parity contract in .agents/localai-assistant-mcp.md.

  2. ModelSchedulingConfig is a direct alias of nodes.ModelSchedulingConfig. That exposes persistence-only state such as the database ID and reconciler cooldown through the public MCP DTO, and imports the service model into the MCP contract. Please define an explicit JSON DTO and conversion helpers instead; the local assistant guide specifically requires DTOs here and says not to expose raw service types.

The HTTP route/client work, tool registration, safety prompt, and validation direction otherwise look sensible. DCO is also currently failing because none of the six commits has the human contributor's Signed-off-by; please add your own sign-off when rewriting the commits.

@owezzy
owezzy force-pushed the feat/mcp-scheduling-parity branch from 4f5808b to 7972666 Compare July 30, 2026 18:23

@localai-org-maint-bot localai-org-maint-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The in-process NodeRegistry plumbing and direct registry operations address the first blocker, and DCO is now green. The DTO boundary is still incomplete, though: ModelSchedulingConfig remains a field-for-field copy of the persistence model and SchedulingConfigFromNode still publishes ID, UnsatisfiableUntil, UnsatisfiableTicks, CreatedAt, and UpdatedAt. Those are the database/reconciler fields called out in the prior review; changing an alias into a struct does not stop them from leaking through the MCP contract.

Please keep only the operator-facing scheduling fields in the MCP DTO (model_name, selector/replica/spread settings, and routing thresholds) and omit the persistence/cooldown fields from the conversion. The HTTP client can decode the REST response into that narrower DTO while ignoring extra REST fields.

I also ran git diff --check successfully. The targeted go test ./pkg/mcp/localaitools/... remains blocked before these packages compile by the existing missing generated pb.DetokenizeRequest / pb.DetokenizeResponse symbols.

owezzy added 7 commits July 31, 2026 10:26
Assisted-by: Hephaestus:openai/gpt-5.5
Signed-off-by: Owen Adirah <owenadira@gmail.com>
Assisted-by: Hephaestus:openai/gpt-5.5
Signed-off-by: Owen Adirah <owenadira@gmail.com>
Assisted-by: Hephaestus:openai/gpt-5.5
Signed-off-by: Owen Adirah <owenadira@gmail.com>
Assisted-by: Hephaestus:openai/gpt-5.5
Signed-off-by: Owen Adirah <owenadira@gmail.com>
Assisted-by: Hephaestus:openai/gpt-5.5
Signed-off-by: Owen Adirah <owenadira@gmail.com>
Assisted-by: Hephaestus:openai/gpt-5.5
Signed-off-by: Owen Adirah <owenadira@gmail.com>
Use an explicit MCP scheduling DTO and route in-process scheduling calls through the distributed node registry so the embedded assistant matches the REST scheduling surface.

Assisted-by: Hephaestus:openai/gpt-5.5
Signed-off-by: Owen Adirah <owenadira@gmail.com>
@owezzy
owezzy force-pushed the feat/mcp-scheduling-parity branch from 7972666 to a32ba23 Compare August 1, 2026 11:42
Assisted-by: Hephaestus:openai/gpt-5.5 [opencode]
Signed-off-by: Owen Adirah <owenadira@gmail.com>
@owezzy
owezzy force-pushed the feat/mcp-scheduling-parity branch from a32ba23 to dada251 Compare August 1, 2026 11:50

@localai-org-maint-bot localai-org-maint-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The current head resolves both prior blockers: the in-process assistant now operates directly on the distributed NodeRegistry, and the explicit MCP DTO exposes only operator-facing scheduling fields. The new in-process and HTTP tests cover the scheduling paths and ensure persistence/cooldown fields do not leak.\n\nVerified at 2f9792cd: go test ./pkg/mcp/localaitools/... passes after regenerating the protobuf bindings, git diff --check passes, and the changed Go files are gofmt-clean.\n\n@mudler this is good to merge.

@mudler
mudler merged commit 8f74f74 into mudler:master Aug 3, 2026
1 check passed
@localai-bot localai-bot added the enhancement New feature or request label Aug 3, 2026
mudler added a commit that referenced this pull request Aug 3, 2026
#11228 added ListScheduling, GetScheduling, SetScheduling and
DeleteScheduling to localaitools.LocalAIClient but did not update
stubClient, the hand-written test double in the mcp endpoints package.
The package therefore fails to typecheck, which takes out both lint and
tests on master:

    cannot use stubClient{} as localaitools.LocalAIClient value in
    argument to h.Initialize: stubClient does not implement
    localaitools.LocalAIClient (missing method DeleteScheduling)

Red on 8f74f74, fd4ec08 and 8a68f35; green on cd62e8f, the commit
before.

Add the four methods with the same inert bodies the rest of the stub
uses. The real implementations are covered in the localaitools suites;
this double only exists so the holder can be constructed.


Assisted-by: Claude Code:claude-opus-5 [Read] [Edit] [Bash]

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distributed routing: minor tuning + MCP scheduling parity follow-ups

4 participants