Model Context Protocol Tools

Every tool the struo mcpModel Context Protocol server advertises in tools/list, with its input schema and a worked return example.

struo_query_artifacts#

Inspect a target's portable artifact export contract without building.

Matches struo query artifacts <target>. Returns capability support, provider declaration shape, metadata bounds, and publication commands. Unknown versioned interfaces are preserved as data, never executed automatically.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string" } }, "required": [ "target" ] }

Example return

json
{"schema":"struo.artifact_contract.v1","target":"site","supported":true}

struo_export_artifacts#

Build and export a self-contained content-addressed artifact set.

Requires struo mcp --allow-run. Matches struo artifact export <target>. Packages declared outputs using bounded streaming copies. Does not publish remotely or start compute. The output option selects the parent directory; the package directory is named by immutable root digest. config accepts KEY=VALUE configuration overrides.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string" }, "output": { "type": "string" }, "config": { "type": "array", "items": { "type": "string" } } }, "required": [ "target" ] }

Example return

json
{"schema":"struo.artifact_export.v1","directory":"/work/project/.struo/artifacts/<digest>"}

struo_publish_artifacts#

Explicitly publish exported artifacts through named infrastructure.

Requires struo mcp --allow-run and authorization to publish to the selected infrastructure. Matches struo artifact publish <target>. Defaults to [infrastructure.artifacts]; provider overrides its name. local retains arbitrary artifact types. Check the selected provider's supported formats and retry guarantees before publishing or retrying. A cache hit never skips publication. Publishing does not run the published content. config accepts KEY=VALUE overrides; track is publication context, not content identity.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string" }, "provider": { "type": "string" }, "track": { "type": "string" }, "config": { "type": "array", "items": { "type": "string" } } }, "required": [ "target" ] }

Example return

json
{"schema":"struo.artifact_publication.v1","provider":"local","target":"site","url":"file:///work/project/.struo/artifacts/<digest>/"}

struo_query_workspace#

Return the configured workspace root, root manifest state, graph loading state, and next calls.

Call this first when filesystem tools and the Struo server may have different working directories. The result identifies the exact workspace every other Struo tool uses, reports the target operating system, architecture, and ordered selection tokens, reports whether the root manifest exists, lists loaded packages and target count, preserves graph loading errors as data, and recommends the next discovery or validation call. The matching command-line operation is struo query workspace --format json.

Input schema

json
{ "type": "object", "properties": {} }

Example return

json
{ "root": "/work/project", "configuration": { "os": "linux", "arch": "aarch64", "tokens": ["linux-arm64", "linux-aarch64", "linux", "arm64", "aarch64", "default"] }, "root_manifest": { "path": "/work/project/struo.toml", "exists": false }, "target_count": 0, "packages": [], "empty": true, "suggested_calls": [ { "tool": "struo_list_target_kinds", "arguments": {}, "reason": "Discover a target kind and starter for this empty workspace." } ] }

struo_list_triggers#

List root trigger declarations and their separately activated snapshot.

Reads data-only root manifest metadata and activation state without loading the graph or evaluating project modules. Candidate declaration edits do not replace the activated contract. Matches struo query triggers.

Input schema

json
{ "type": "object", "properties": {} }

Example return

json
{"schema":"struo.triggers.v1","triggers":[],"diagnostics":[],"activation":null}

struo_validate_trigger#

Validate one data-only trigger declaration with exact refs and configured invocations.

Validates { trigger: { id, on: { event, refs }, invoke: [{ target, capability, configuration: { os, arch, tokens } }] } } without graph loading or project-module evaluation. Platform configuration is explicit, including an empty tokens list when no additional tokens are needed. This does not prove that a configured target exists or executes successfully. Matches struo query validate-trigger --file <path>; the CLI also accepts stdin.

Input schema

json
{ "type": "object", "properties": { "trigger": { "type": "object", "additionalProperties": false, "properties": { "id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$" }, "on": { "type": "object", "additionalProperties": false, "properties": { "event": { "type": "string", "const": "vcs.ref_changed" }, "refs": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "description": "Exact fully qualified ref, such as refs/heads/main. Patterns are not supported." } } }, "required": [ "event", "refs" ] }, "invoke": { "type": "array", "minItems": 1, "items": { "type": "object", "additionalProperties": false, "properties": { "target": { "type": "string", "minLength": 1, "description": "Exact canonical workspace-relative target id." }, "capability": { "type": "string", "enum": [ "build", "test", "run" ] }, "configuration": { "type": "object", "additionalProperties": false, "properties": { "os": { "type": "string", "minLength": 1 }, "arch": { "type": "string", "minLength": 1 }, "tokens": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } } }, "required": [ "os", "arch", "tokens" ] } }, "required": [ "target", "capability", "configuration" ] } } }, "required": [ "id", "on", "invoke" ] } }, "required": [ "trigger" ] }

Example return

json
{"valid":true,"diagnostics":[]}

struo_edit_triggers#

Atomically create, replace, or delete root trigger declarations without activating them.

Requires struo mcp --allow-run. Applies an ordered operation batch to the root struo.toml only. An update replaces the complete declaration identified by id. A rejected batch leaves the manifest unchanged; no edit changes the activated snapshot. Matches struo edit triggers --file <path>; the CLI also accepts stdin.

Input schema

json
{ "type": "object", "properties": { "operations": { "type": "array", "items": { "oneOf": [ { "type": "object", "additionalProperties": false, "properties": { "op": { "type": "string", "const": "create" }, "trigger": { "type": "object", "additionalProperties": false, "properties": { "id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$" }, "on": { "type": "object", "additionalProperties": false, "properties": { "event": { "type": "string", "const": "vcs.ref_changed" }, "refs": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "description": "Exact fully qualified ref, such as refs/heads/main. Patterns are not supported." } } }, "required": [ "event", "refs" ] }, "invoke": { "type": "array", "minItems": 1, "items": { "type": "object", "additionalProperties": false, "properties": { "target": { "type": "string", "minLength": 1, "description": "Exact canonical workspace-relative target id." }, "capability": { "type": "string", "enum": [ "build", "test", "run" ] }, "configuration": { "type": "object", "additionalProperties": false, "properties": { "os": { "type": "string", "minLength": 1 }, "arch": { "type": "string", "minLength": 1 }, "tokens": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } } }, "required": [ "os", "arch", "tokens" ] } }, "required": [ "target", "capability", "configuration" ] } } }, "required": [ "id", "on", "invoke" ] } }, "required": [ "op", "trigger" ] }, { "type": "object", "additionalProperties": false, "properties": { "op": { "type": "string", "const": "update" }, "id": { "type": "string" }, "trigger": { "type": "object", "additionalProperties": false, "properties": { "id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$" }, "on": { "type": "object", "additionalProperties": false, "properties": { "event": { "type": "string", "const": "vcs.ref_changed" }, "refs": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "description": "Exact fully qualified ref, such as refs/heads/main. Patterns are not supported." } } }, "required": [ "event", "refs" ] }, "invoke": { "type": "array", "minItems": 1, "items": { "type": "object", "additionalProperties": false, "properties": { "target": { "type": "string", "minLength": 1, "description": "Exact canonical workspace-relative target id." }, "capability": { "type": "string", "enum": [ "build", "test", "run" ] }, "configuration": { "type": "object", "additionalProperties": false, "properties": { "os": { "type": "string", "minLength": 1 }, "arch": { "type": "string", "minLength": 1 }, "tokens": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } } }, "required": [ "os", "arch", "tokens" ] } }, "required": [ "target", "capability", "configuration" ] } } }, "required": [ "id", "on", "invoke" ] } }, "required": [ "op", "id", "trigger" ] }, { "type": "object", "additionalProperties": false, "properties": { "op": { "type": "string", "const": "delete" }, "id": { "type": "string" } }, "required": [ "op", "id" ] } ] } } }, "required": [ "operations" ] }

Example return

json
{"applied":true,"changed":true,"path":"/work/project/struo.toml"}

struo_activate_triggers#

Activate root trigger declarations from an exact committed definition revision.

Requires struo mcp --allow-run. Replaces the activated snapshot separately from candidate edits, using declarations from the full source revision supplied by the caller. Activation is local state, not authenticated event provenance or external required-check authorization. Matches struo edit activate-triggers --revision <full-sha>.

Input schema

json
{ "type": "object", "properties": { "revision": { "type": "string", "pattern": "^([0-9a-f]{40}|[0-9a-f]{64})$" } }, "required": [ "revision" ] }

Example return

json
{"activated":true}

struo_plan_trigger#

Simulate an event against one activated trigger without executing work.

Matches the exact ref against the activated declaration and returns its exact target, capability, and explicit configuration selections. This is data-only simulation, not authenticated source-host provenance, graph analysis, or status publication. Does not evaluate project modules. Matches struo query trigger-plan <id> --file <event-path>.

Input schema

json
{ "type": "object", "properties": { "id": { "type": "string" }, "event": { "type": "object", "additionalProperties": false, "properties": { "event": { "type": "string", "const": "vcs.ref_changed" }, "ref": { "type": "string", "minLength": 1, "description": "Exact fully qualified ref." }, "revision": { "type": "string", "pattern": "^([0-9a-f]{40}|[0-9a-f]{64})$" } }, "required": [ "event", "ref", "revision" ] } }, "required": [ "id", "event" ] }

Example return

json
{"schema":"struo.trigger_selection.v1","mode":"simulation","contract_generation":"019b0000-0000-7000-8000-000000000000","definition_revision":"0123456789012345678901234567890123456789","observation":{"event":"vcs.ref_changed","ref":"refs/heads/main","revision":"0123456789012345678901234567890123456789"},"trigger":{"id":"verify-main","on":{"event":"vcs.ref_changed","refs":["refs/heads/main"]},"invoke":[{"target":"checks/core","capability":"test","configuration":{"os":"linux","arch":"x86_64","tokens":[]}}]}}

struo_run_trigger#

Execute an activated trigger on the existing CI worker within one resource budget.

Requires struo mcp --allow-run. Executes the activated exact configured invocations using the supplied local event document and the server's memory budget. The event does not authenticate origin or authorize privileges. The CI worker remains responsible for isolation, lifecycle, credentials, and external checks. No native webhook, controller, or status publication is created. A failed aggregate returns isError while retaining the structured result. Matches struo run --trigger <id> --event <event-path>.

Input schema

json
{ "type": "object", "properties": { "id": { "type": "string" }, "event": { "type": "object", "additionalProperties": false, "properties": { "event": { "type": "string", "const": "vcs.ref_changed" }, "ref": { "type": "string", "minLength": 1, "description": "Exact fully qualified ref." }, "revision": { "type": "string", "pattern": "^([0-9a-f]{40}|[0-9a-f]{64})$" } }, "required": [ "event", "ref", "revision" ] } }, "required": [ "id", "event" ] }

Example return

json
{"schema":"struo.trigger_run.v1","mode":"simulation","status":"failed","error":"configured trigger target is missing"}

struo_query_targets#

List every declared target in the workspace, optionally filtered by target kind.

Returns the same record shape as struo query targets --format json: one entry per declared target with its canonical id, package, name, target kind, visibility rules, default dependencies, named dependency roles, and exposed capabilities. The optional kind argument narrows results to one target kind.

Input schema

json
{ "type": "object", "properties": { "kind": { "type": "string", "description": "Restrict results to a target kind discovered through `struo_list_target_kinds`." } } }

Example return

json
[ { "id": "packages/core/Core", "package": "packages/core", "name": "Core", "kind": "library", "visibility": ["subtree:apps"], "deps": [], "dependency_edges": {}, "capabilities": ["build"] }, { "id": "apps/service/Service", "package": "apps/service", "name": "Service", "kind": "application", "visibility": [], "deps": ["packages/core/Core"], "dependency_edges": { "plugins": ["tools/compiler/Plugin"] }, "capabilities": ["build", "run"] } ]

struo_query_capabilities#

Return the capabilities (build, lint, run, test) a target exposes, with their output groups and required inputs.

Returns the same record struo query capabilities <target> --format json emits: the target's id and kind plus one entry per capability with its output groups (what running the capability produces) and required outputs (what it depends on having built).

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Canonical target id, such as `apps/service/Service`." } }, "required": [ "target" ] }

Example return

json
{ "id": "apps/service/Service", "kind": "application", "capabilities": [ { "name": "build", "output_groups": ["default", "package"], "requires_outputs": [] }, { "name": "run", "output_groups": ["default"], "requires_outputs": ["package"] } ] }

struo_query_schema#

Return the typed contract for a target kind: attributes, dep edges, providers, capabilities, source references, and runnable starters.

Returns the target kind schema (the typed contract a target of that kind must match) as struo query schema <kind> --format json would. The record carries the target kind's documentation, attribute list with types and required, configurable, implemented, and allowed-value fields, expected dep providers, emitted providers, exposed capabilities, required tools, external source concepts that can guide partial adoption, and a lightweight list of runnable starter examples. Attributes marked implemented: false are discoverable compatibility fields that validation rejects until their target kind gives them behavior. Use struo_materialize_example to create an unchanged starter without loading its contents into model context, or struo_query_example when the caller needs to inspect and adapt the files.

Input schema

json
{ "type": "object", "properties": { "kind": { "type": "string", "description": "Target kind to introspect. Discover names with `struo_list_target_kinds`." } }, "required": [ "kind" ] }

Example return

json
{ "kind": "library", "docs": "Reusable library target...", "attrs": [ { "name": "mode", "ty": "string", "required": false, "configurable": true, "implemented": true } ], "capabilities": [ { "name": "build", "output_groups": ["default"], "requires_outputs": [] } ], "providers": ["linkable", "module"], "source_references": [ { "system": "Example Build", "symbol": "example_library", "url": "https://example.com/example_library", "use_when": "...", "content_digest": "..." } ], "examples": [ { "slug": "library-minimal", "name": "Minimal library", "use_when": "..." } ] }

struo_query_example#

Return the complete file bundle for one target kind starter example.

Returns the same record as struo query example <kind> <slug> --format json: the selected example's slug, name, selection hint, and every file a caller can inspect or adapt. Text files use contents; binary files use contents_base64. Example descriptors are discovered through struo_list_target_kinds or struo_query_schema. For direct setup, prefer struo_materialize_example, which writes the bundle without sending large dependency payloads through model context.

Input schema

json
{ "type": "object", "properties": { "kind": { "type": "string", "description": "Target kind that owns the example." }, "slug": { "type": "string", "description": "Example slug from the target kind schema." } }, "required": [ "kind", "slug" ] }

Example return

json
{ "slug": "library-minimal", "name": "Minimal library", "use_when": "...", "files": [ { "path": "packages/core/struo.toml", "contents": "[[target]]\nname = \"Core\"\nkind = \"library\"\n..." } ] }

struo_materialize_example#

Materialize a complete target kind starter directly inside the configured workspace.

This collision-safe setup tool is available only when the server starts with struo mcp --allow-run. It copies the selected example without returning its file contents through model context. Existing files with identical contents are kept, making retries idempotent. If any path conflicts, Struo reports every conflict and writes nothing. A successful result includes created and unchanged paths, canonical targets, complete-workspace validation, and exact suggested tool calls for targets of the requested kind. The matching command-line operation is struo edit materialize-example <kind> <slug> --destination <dir>.

Input schema

json
{ "type": "object", "properties": { "kind": { "type": "string", "description": "Target kind that owns the example." }, "slug": { "type": "string", "description": "Example slug from `struo_list_target_kinds` or `struo_query_schema`." }, "destination": { "type": "string", "default": "", "description": "Workspace-relative destination directory. Use an empty string for the workspace root." } }, "required": [ "kind", "slug" ] }

Example return

json
{ "materialized": true, "kind": "library", "slug": "library-minimal", "destination": "", "created_files": ["packages/core/struo.toml", "packages/core/src/core.txt"], "unchanged_files": [], "conflicts": [], "targets": [ { "id": "packages/core/Core", "kind": "library", "capabilities": ["build"] } ], "workspace_validation": { "valid": true, "target_count": 1, "diagnostics": [] }, "suggested_calls": [ { "tool": "struo_validate_workspace", "arguments": {}, "reason": "Confirm the complete workspace after any customization." }, { "tool": "struo_build_target", "arguments": { "target": "packages/core/Core" }, "reason": "Build the materialized `library` target." } ] }

struo_list_target_kinds#

List target kinds with their docs, external source references, and example slugs, optionally filtered by ecosystem or intent.

Lightweight discovery entry point. Returns matching target kinds with documentation, external build-system concepts they can partially replace, and bundled starter examples. When the request names one or more ecosystems or runner families, include all of their names in the short query copied from the request. Struo combines those specific matches while ignoring generic intent words, which lets a harness discover every native test integration in a mixed repository with one call. Omit the query when the intent is unknown. Call struo_query_schema for the full contract of each chosen target kind. The matching command-line operation is struo query target-kinds --query <text> --format json.

Input schema

json
{ "type": "object", "properties": { "query": { "type": "string", "description": "Short ecosystem, target-kind family, or intent text copied from the user's request." } } }

Example return

json
[ { "kind": "library", "docs": "Reusable library target...", "source_references": [ { "system": "Example Build", "symbol": "example_library", "url": "https://example.com/example_library", "use_when": "...", "content_digest": "..." } ], "examples": [ { "slug": "library-minimal", "name": "Minimal library", "use_when": "..." } ] } ]

struo_query_module_contract#

Return the complete project-module authoring contract, primitives, invariants, capability starters, and normalized result examples.

Use this when no discovered target kind covers an external rule or plugin. The result contains the exact Starlark declaration helpers, schema invariants, implementation context fields, generic host-analysis and action primitives, module registration snippet, maintenance loop, and runnable generic, lint, and test starters with normalized result examples. A coding harness can use it to author and maintain a project-local target kind without waiting for a built-in integration. The matching command-line operation is struo query module-contract --format json.

Input schema

json
{ "type": "object", "properties": {} }

Example return

json
{ "language": "Starlark", "registration": "[modules]\npaths = [\"modules/*.star\"]\n", "schema_invariants": ["attr.default is optional schema documentation and must be a string..."], "context_fields": [ { "signature": "ctx[\"attr\"]", "purpose": "Typed target attributes." } ], "action_primitives": [ { "signature": "write_path(path, content)", "purpose": "Declare a portable file-writing action." }, { "signature": "materialize_host_file(source, destination)", "purpose": "Snapshot a content-verified absolute host toolchain file into a workspace output." }, { "signature": "materialize_host_tree(source, destination)", "purpose": "Snapshot a content-verified absolute host directory into a workspace output." } ], "starter": "def _generated_text_impl(ctx): ...", "lint_starter": "def _scripted_lint_impl(ctx): ...", "lint_target_starter": "[[target]]\nname = \"lint\"\nkind = \"scripted_lint\"\n...", "lint_adapter_starter": "import argparse\nimport json\n...", "normalized_lint_result_example": { "schema": "struo.lint_results.v1", "status": "completed" }, "test_starter": "def _scripted_test_impl(ctx): ..." }

struo_fetch_external_source#

Fetch bounded UTF-8 source code, metadata, or documentation from a public HTTPS address.

Fetches an authoritative external rule, plugin, registry record, or build-system reference for a coding harness to inspect before generating a local Struo target kind. Only public HTTPS addresses are accepted, redirects are not followed, and response content is bounded to one mebibyte. The result includes the content, media type, digest, byte count, and truncation state. The matching command-line operation is struo query external-source <url> --format json.

Input schema

json
{ "type": "object", "properties": { "url": { "type": "string", "description": "Public HTTPS address for external source code, metadata, or documentation." }, "max_bytes": { "type": "integer", "minimum": 1, "maximum": 1048576, "default": 262144, "description": "Maximum response bytes to return." } }, "required": [ "url" ] }

Example return

json
{ "url": "https://example.com/rules/example.rule", "content_type": "text/plain", "content_digest": "...", "byte_count": 4120, "truncated": false, "content": "rule implementation..." }

struo_validate_module#

Validate a project-local Starlark module and return its target kind contracts before registration or execution.

Reads one workspace-relative module file, evaluates it with the public Struo declarations and generic primitives, and returns either its discovered target kind schemas or a structured repair diagnostic. Use it after a harness writes or updates an external-rule adaptation and before registering targets that depend on it. The matching command-line operation is struo query validate-module <path> --format json.

Input schema

json
{ "type": "object", "properties": { "path": { "type": "string", "description": "Workspace-relative path to a Starlark module file." } }, "required": [ "path" ] }

Example return

json
{ "valid": true, "path": "modules/generated_text.star", "target_kinds": [ { "kind": "generated_text", "providers": ["generated_file"], "capabilities": [ { "name": "build", "output_groups": ["default"] } ] } ], "diagnostics": [] }

struo_get_target#

Return one resolved target with its sources, dependency roles, typed attributes, capabilities, and providers.

Returns the same GraphTarget record struo_query_targets emits, scoped to one target id. Includes default dependencies in deps, named roles in dependency_edges, typed attribute values, exposed capabilities, emitted providers, and manifest diagnostics. Use this before editing a target to learn its current shape.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Canonical target id, such as `packages/core/Core`." } }, "required": [ "target" ] }

Example return

json
{ "label": { "package": "packages/core", "name": "Core", "id": "packages/core/Core" }, "kind": "library", "srcs": ["src/**/*.src"], "visibility": ["subtree:apps"], "deps": [], "dependency_edges": { "plugins": ["tools/compiler/Plugin"] }, "attrs": {}, "capabilities": [ { "name": "build", "output_groups": ["default"], "requires_outputs": [] } ], "providers": ["linkable", "module"] }

struo_query_tests#

List targets that expose Struo's generic test capability.

Returns every target with a test capability, including its target kind, dependencies, runner type when the target kind exposes struo_test_info, labels, and normalized result path. Use this as the agent test discovery entry point before running or filtering tests.

Input schema

json
{ "type": "object", "properties": {} }

Example return

json
[ { "id": "tests/unit", "kind": "test_suite", "deps": [], "runner": "unit", "labels": ["fast"], "results_path": ".struo/out/tests/unit/test/test_results.json" } ]

struo_query_affected_tests#

Return test targets likely affected by a set of changed workspace paths.

Maps changed paths to test targets using graph relationships, declared inputs, and package ownership. A test is affected when a changed path belongs to the test target itself or to one of its declared dependencies. Declared source patterns are matched without requiring the changed file to still exist. An otherwise unowned path, including a package manifest, belongs to the nearest package and selects only that package's reverse dependency closure. The root manifest, configured graph modules, and paths outside every known package conservatively select every test. Selection does not depend on a particular test runner.

Input schema

json
{ "type": "object", "properties": { "changed_paths": { "type": "array", "items": { "type": "string" }, "description": "Workspace-relative changed paths. An empty list returns every test target." } } }

Example return

json
[ { "id": "tests/unit", "kind": "test_suite", "reasons": ["changed test input `tests/unit/spec.src`"] } ]

struo_query_test_plan#

Export a replayable test plan with complete discovery and input bindings.

Returns a struo.portable_test_plan.v1 document with selection reasons, stable batches, complete discovery inventories, and input/configuration bindings. Every exported plan can be replayed on a fresh worker using struo test --plan <file> --batch <id> without copying private state or reconstructing runner filters. Select targets with either target or changed_paths, never both. Plans always cover complete selected targets; choose batches at execution, not during export. Missing or stale discovery produces a whole-target fallback. Run targets completely with struo_run_tests, then query again for automatic file or case batches. Worker counts and placement are not part of batch identity. The matching command is struo query test-plan --format json.

Input schema

json
{ "type": "object", "properties": { "changed_paths": { "type": "array", "items": { "type": "string" }, "description": "Workspace-relative changed paths. An empty list creates a full test plan." }, "target": { "type": "string", "description": "Explicit canonical test target. Conflicts with changed_paths." }, "coverage_selection": { "type": "boolean", "default": false, "description": "Opt in to approximate whole-target exclusion using Tuist coverage history. Executes native inventory discovery, so requires --allow-run. Requires changed_paths and conflicts with target. Missing or incompatible evidence retains graph-selected work." } }, "additionalProperties": false }

Example return

json
{ "schema": "struo.portable_test_plan.v1", "id": "<bound plan digest>", "plan": { "schema": "struo.test_plan.v1", "id": "<scope digest>", "selection": { "schema": "struo.test_selection.v1", "policy": { "mode": "affected", "safety": "conservative", "evidence": "declared_graph_and_package_ownership" }, "changed_paths": ["src/lib.src"], "unmatched_paths": [], "tests": [{ "id": "tests/unit", "kind": "test_suite", "reasons": ["changed dependency `lib` input `src/lib.src`"] }] }, "batches": [{ "id": "<batch digest>", "target": "tests/unit", "test_filters": [] }] }, "bindings": [{ "target": "tests/unit", "fingerprint": "<input digest>", "manifest": null }] }

struo_run_tests#

Run test targets by id, or run tests affected by changed workspace paths.

Schedules selected test scopes through a shared local queue. Batches with longer historical uncached durations are queued first, and idle workers dynamically take the next batch. Explicit target or targets produce an exact plan; otherwise changed_paths drive conservative graph selection. With exactly one target, test_unit runs a stable unit returned by struo_query_test_manifest when the target kind declares filtering support. With exactly one target, test_batch reruns one batch ID from the target's current plan without splitting its fixture scope. It conflicts with test_unit and changed paths. Unknown or obsolete IDs fail before execution and suggest current batches. The matching command is struo test <target> --test-batch <id> --format json. jobs caps workers without changing plan or batch identity. Set summary_only for compact normalized totals without case-level records. The result's plan is the work that just executed. Its next_plan is recomputed after complete runs refresh discovery, so use that field to assess file or case batching for the next run. The result also includes actual schedule attempts and normalized test results. Failed tests are returned as normal tool content with success: false rather than a tool protocol error, so agents can inspect failures and iterate. The matching command-line operations are struo test --changed-path <path> --jobs <count> --format json and struo test <target> --test-unit <unit> --format json.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Single canonical target id to run, such as `tests/unit`." }, "targets": { "type": "array", "items": { "type": "string" }, "description": "Canonical target ids to run. Used with `target`, this is deduplicated before execution." }, "changed_paths": { "type": "array", "items": { "type": "string" }, "description": "Workspace-relative changed paths. Used only when no explicit target is supplied; an empty list runs every discovered test target." }, "jobs": { "type": "integer", "minimum": 1, "maximum": 256, "description": "Maximum local workers. Defaults to available host parallelism and never changes plan or batch identity." }, "test_unit": { "type": "string", "description": "Run one stable unit identifier returned by struo_query_test_manifest. Requires exactly one explicit target." }, "test_batch": { "type": "string", "description": "Run one batch ID from the target's current struo_query_test_plan. Requires exactly one explicit target; conflicts with test_unit and changed_paths." }, "summary_only": { "type": "boolean", "description": "Replace case-level normalized results with compact struo.test_results_summary.v1 totals." } } }

Example return

json
{ "plan": { "schema": "struo.test_plan.v1", "id": "<executed plan digest>", "selection": {}, "batches": [] }, "next_plan": { "schema": "struo.test_plan.v1", "id": "<next plan digest>", "selection": {}, "batches": [] }, "schedule": { "schema": "struo.test_schedule.v1", "id": "<attempt-specific digest>", "plan_id": "<executed plan digest>", "strategy": "longest_estimated_duration_first_dynamic", "workers": 2, "attempts": [{ "batch_id": "<stable batch digest>", "placement": "local", "worker": "local-1", "status": "passed" }] }, "runs": [ { "batch_id": "<stable batch digest>", "target": "tests/unit", "exit_code": 0, "success": true, "record": { "target": "tests/unit", "capability": "test" }, "results": { "schema": "struo.test_results.v1", "status": "passed" }, "stderr": "" } ] }

struo_query_test_results#

Read normalized struo.test_results.v1 results for a target.

Reads retained normalized results without graph evaluation, discovery updates, or execution, even if the current manifest is missing or broken. Set summary_only for totals without cases. Set case to an exact retained case id for struo.test_case_result.v1 evidence, and optionally attempt to a one-based producer attempt array position (defaults to the last element, not timestamp order). Positions are not schedule retries or durable cross-run ids; results_digest is the BLAKE3 digest of the same bytes read. Raw target status, case status, and the complete selected attempt object remain distinct, including unknown producer fields and statuses. target_artifacts stays separate with artifact_availability=not_checked; paths are inert and no attachments are read, fetched, or published. Rerun argv is only a whole-target suggestion using current configuration, not an exact-case or historical replay promise. Focused reads accept at most 16777216 raw file bytes and 1048576 compact logical projection JSON bytes, checked by counting serialization before materialization. These are not peak-memory or wire-envelope limits: CLI pretty printing and MCP's duplicated structured/text envelope can be larger. Focused failures return structured diagnostics with code, target, attribute, and repairs. case conflicts with summary_only; attempt requires case and must be positive. Matches struo query test-results <target> --case <id> --attempt <position> --format json. Without selectors the legacy full/summary views and their limits are unchanged.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Canonical target id, such as `tests/unit`." }, "summary_only": { "type": "boolean", "description": "Return struo.test_results_summary.v1 status, totals, runner, and artifacts without case-level records." }, "case": { "type": "string", "minLength": 1, "description": "Exact retained case id to inspect; conflicts with summary_only." }, "attempt": { "type": "integer", "minimum": 1, "description": "One-based producer attempt array position within case; requires case. Defaults to the last element." } }, "required": [ "target" ] }

Example return

json
{ "schema": "struo.test_results.v1", "target": "tests/unit", "runner": { "type": "native", "metadata": {} }, "status": "passed", "summary": { "total": 1, "passed": 1, "failed": 0, "skipped": 0, "flaky": 0 }, "cases": [{ "id": "tests/unit::case_name", "name": "case_name", "suite": "tests/unit", "status": "passed", "attempts": [{ "status": "passed" }], "runner_metadata": {} }], "artifacts": { "logs": [], "native_results": [] } }

struo_query_test_manifest#

List stable test units discovered in a target's normalized results.

Returns an immutable struo.test_manifest.v1 projection of the target's current normalized test results and its target-kind-declared listing and filtering support. When no results exist, the manifest reports whole_target_fallback with no units; run the whole target once to refresh discovery. Unit identifiers can be passed to struo_run_tests only when case_filtering is runner_args. The matching command-line operation is struo query test-manifest <target> --format json.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Canonical target identifier, such as `tests/unit`." } }, "required": [ "target" ] }

Example return

json
{ "schema": "struo.test_manifest.v1", "id": "<stable digest>", "target": "tests/unit", "runner": "native", "source": "normalized_results", "listing_supported": true, "case_filtering": "runner_args", "units": [{ "id": "tests/unit::case_name", "name": "case_name", "suite": "tests/unit" }] }

struo_query_test_attempts#

List persisted test batch attempts and measured durations.

Returns actual schedule attempts recorded by struo_run_tests or struo test --changed-path. Each record connects a stable plan and batch to its local worker, status, cache state, timestamps, measured duration, and the estimate used for ordering. Use target to inspect one test target and limit to bound history. The matching command-line operation is struo query test-attempts --target <target> --limit <count> --format json.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Optional canonical test target id." }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20, "description": "Newest matching attempts to return." } } }

Example return

json
[ { "schema": "struo.test_batch_attempt.v1", "plan_id": "<stable plan digest>", "batch_id": "<stable batch digest>", "target": "tests/unit", "placement": "local", "worker": "local-1", "duration_ms": 842, "status": "passed", "cache": "miss" } ]

struo_query_verification#

Inspect a retained reproducibility check without executing commands.

Returns the same struo.verification.v1 record as struo query verification <id> --format json. Start a check with verify_reproducible on struo_build_target or struo_exec_script. The record separates execution status, artifact equality, and log equality, retains trial results and decoded artifact paths, and includes bounded file-level differences and explicit scope limitations. No divergence observed is not proof of reproducibility. Reports and artifacts are local workspace runtime state and are never published automatically.

Input schema

json
{ "type": "object", "properties": { "id": { "type": "string", "description": "Verification UUID returned by a completed check." } }, "required": [ "id" ] }

Example return

json
{ "schema": "struo.verification.v1", "id": "019a0000-0000-7000-8000-000000000001", "success": true, "execution_succeeded": true, "artifacts_match": true, "logs_match": false }

struo_query_evidence#

List durable evidence records, optionally filtered by subject.

Returns the same record shape as struo query evidence --format json: durable action evidence captured after struo exec, struo run, struo build, struo lint, or struo test. Declared graph actions include an input fingerprint manifest whose categorized components explain which hashed source, dependency, toolchain, command, environment, or module input changed without exposing raw command or environment values. Other action types omit the optional manifest. Pass subject to filter to one command action, target, or target capability, such as cli or cli:test. The tool returns the newest five matching records by default; set limit from 1 through 100 when more or fewer are useful. The matching command-line option is struo query evidence --limit <count>. Evidence is historical provenance, not proof that inputs remain unchanged; run the relevant capability when a current result is required.

Input schema

json
{ "type": "object", "properties": { "subject": { "type": "string", "description": "Optional subject id or subject-capability pair, such as `cli` or `cli:test`." }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, "default": 5, "description": "Maximum number of newest matching records to return." } } }

Example return

json
[ { "schema": "struo.evidence.v1", "id": "8d65122cd9dcddc8d5d9a8458ff42a40fe3dd7acbd4e0563fd7f9e8fb19b0c44", "kind": "action_result", "subject": { "kind": "target", "id": "cli", "capability": "test" }, "status": "passed", "action_digest": "0476bde2e7d8d1a64d9bd6f589ef5b443d0f60b71e2ad6f1c5bd7a2c4c41223f", "input_digest": "8ed3f6ad685b959ead7022518e1af76cd816f8e8ec7ccd5f5814ccfb820e6a41", "input_fingerprint": { "schema": "struo.input_fingerprint.v1", "input_digest": "8ed3f6ad685b959ead7022518e1af76cd816f8e8ec7ccd5f5814ccfb820e6a41", "components": [ { "category": "source", "label": "src/lib.rs", "digest": "1111111111111111111111111111111111111111111111111111111111111111" }, { "category": "dependency", "label": "core", "digest": "2222222222222222222222222222222222222222222222222222222222222222" } ] }, "cache": "miss", "exit_code": 0, "stdout": "b439bb065d84034c2e7172c1709eb28797c9bd7f2c64c5d1a1d9c1118f6f9d7e", "created_at_unix_ms": 1812345678901 } ]

struo_query_graph_fingerprint#

Compute a deterministic, content-addressed digest of the whole graph.

Returns the same record as struo query graph-fingerprint --format json: a single stable digest that folds in every target declaration, the resolved contents of every declared source file, the pinned Mise toolchain (mise.toml and mise.lock when present), and the root workspace manifest. The digest changes whenever any of those inputs change, so two identical checkouts on different machines produce the same digest. components lists the categorized (category, label, digest) triples behind the digest, mirroring per-action input fingerprints, so a caller can see which target, source, toolchain, or manifest input contributed. Categories default to all on; set include_sources, include_toolchain, or include_manifest to false to scope the digest, for example to compare only graph structure across checkouts. The matching command-line operation is struo query graph-fingerprint [--no-sources --no-toolchain --no-manifest].

Input schema

json
{ "type": "object", "properties": { "include_sources": { "type": "boolean", "default": true, "description": "Fold resolved source file contents into the digest." }, "include_toolchain": { "type": "boolean", "default": true, "description": "Fold the `mise.toml` and `mise.lock` declarations into the digest." }, "include_manifest": { "type": "boolean", "default": true, "description": "Fold the root `struo.toml` manifest into the digest." } } }

Example return

json
{ "schema": "struo.graph_fingerprint.v1", "digest": "a046fc32a4c232b7320b4249d630ec5a4fef9ae8c3313a65754f33cc31375676", "target_count": 2, "source_count": 1, "components": [ { "category": "target", "label": "pkg/lib", "digest": "1111111111111111111111111111111111111111111111111111111111111111" }, { "category": "source", "label": "pkg/lib.rs", "digest": "2222222222222222222222222222222222222222222221111111111111111111" }, { "category": "toolchain", "label": "mise.toml", "digest": "3333333333333333333333333333333333333333333333333333333333333333" } ] }

struo_export_graph_repro#

Export a redacted reproduction of the workspace's native projects and draft an issue to report a graph problem.

Requires struo mcp --allow-run. Matches struo query graph-repro --format json. Use it when a native project's graph fails to load or disagrees with what the native build system builds, instead of changing the project to work around Struo. Writes .struo/graph-repro, replacing only the files of an earlier export there, and shares nothing. workspace/ mirrors every native project: files matching the native project's declared manifests keep their contents, and every other file becomes an empty placeholder at the same path, so globs and resolvers see the same tree without source code. repro.json records the Struo version, host platform, the loaded graph with absolute workspace and home paths replaced by $WORKSPACE and $HOME, diagnostics, and the loading error when there is one. Credentials in copied URLs and values of environment attributes are replaced with <redacted>. ISSUE.md drafts an issue from those facts alone, and graph-repro.tar.gz packs the export to attach to it. The result's issue gives the repository, title, body file, and a prefilled link. Ask the user to review the copied files and repro.json before opening the issue, and to attach the archive in the browser.

Input schema

json
{ "type": "object", "properties": {} }

Example return

json
{ "schema": "struo.graph_repro_export.v1", "directory": "/work/project/.struo/graph-repro", "archive": "/work/project/.struo/graph-repro/graph-repro.tar.gz", "copied": ["project.lock", "project.native"], "redacted_count": 42, "target_count": null, "load_error": "loading graph: target kind resolver failed for `native`", "issue": { "repository": "tuist/struo", "title": "Native graph fails to load: native", "body_path": "/work/project/.struo/graph-repro/ISSUE.md", "url": "https://github.com/tuist/struo/issues/new?title=..." } }

struo_validate_script#

Parse and validate an annotated script's cache contract.

Reads a workspace-relative script, validates its shebang and struo directives, and returns the parsed runtime, inputs, outputs, dependency scripts, fingerprints, environment names, working directory, remote policy, and output symlink policy. Put singular directives with quoted values directly after the shebang, for example # struo input "input.txt" and # struo output "output.txt". Plural names, colon syntax, and unquoted paths are invalid. Invalid contracts return { valid: false, diagnostics: [...] }, so callers can repair directive typos before execution. The matching command-line operation is struo query script <path>.

Input schema

json
{ "type": "object", "properties": { "path": { "type": "string", "description": "Workspace-relative annotated script path." } }, "required": [ "path" ] }

Example return

json
{ "valid": true, "path": "scripts/build.sh", "contract": { "path": "scripts/build.sh", "runtime": "sh", "runtime_args": [], "inputs": ["src/**"], "outputs": ["dist/**"], "needs": [], "fingerprints": [], "env_vars": [] } }

struo_exec_script#

Execute a validated annotated script through Struo's action cache.

Opt-in tool exposed only when the Model Context Protocol server starts with struo mcp --allow-run. Validates the script contract before running the same path as struo exec --script, materializes declared outputs, and returns captured streams, exit status, action digest, cache hit or miss state, and matching evidence. Invoke it twice with unchanged declared inputs to verify cache reuse. Set verify_reproducible to run struo exec --verify-reproducible --script instead: two private workspace trials rerun script dependencies and fingerprints with initially empty local Struo caches and return struo.verification.v1 directly. The check retains both trials, compares artifacts separately from logs, and does not replace workspace outputs. Host tool caches, absolute paths, network services, and external side effects are not isolated; authorize repeated execution before using it.

Input schema

json
{ "type": "object", "properties": { "path": { "type": "string", "description": "Workspace-relative annotated script path." }, "args": { "type": "array", "items": { "type": "string" }, "description": "Arguments passed to the script after its path." }, "verify_reproducible": { "type": "boolean", "default": false, "description": "Run and retain two private trials instead of normal cached execution. Returns struo.verification.v1." } }, "required": [ "path" ] }

Example return

json
{ "path": "scripts/build.sh", "success": true, "exit_code": 0, "stdout": "built\n", "stderr": "", "record": { "action_digest": "0476bde2e7d8d1a64d9bd6f589ef5b443d0f60b71e2ad6f1c5bd7a2c4c41223f", "cache": "hit", "exit_code": 0 }, "evidence_subject": "0476bde2e7d8d1a64d9bd6f589ef5b443d0f60b71e2ad6f1c5bd7a2c4c41223f", "evidence": [] }

struo_build_target#

Build a target by running its generic build capability.

This tool is available only when the server starts with struo mcp --allow-run. It behaves like struo build <target> --format json, including dependency traversal, target actions, cache policy, and output groups. Because cache identity follows declared content rather than workspace history, a first build in a new workspace can reuse an equivalent action produced elsewhere. The result includes the exit status, command diagnostics under stderr, and bounded declared action logs under captured_stdout and captured_stderr. A captured field is null when the target did not declare that log. A failed build is returned as normal tool content with success: false so agents can inspect diagnostics. Set verify_reproducible to run struo build --verify-reproducible <target> instead and return struo.verification.v1 directly. It runs the dependency closure in each of two private workspace trials with initially empty local Struo caches, retains both results, compares artifacts separately from logs, and leaves workspace outputs untouched. Host tool caches, absolute paths, network services, and external side effects are not isolated.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Target id to build, such as `apps/service/Service` or `./Service`." }, "verify_reproducible": { "type": "boolean", "default": false, "description": "Run and retain two private trials instead of normal cached execution. Returns struo.verification.v1." } }, "required": [ "target" ] }

Example return

json
{ "target": "apps/service/Service", "capability": "build", "exit_code": 0, "success": true, "record": { "target": "apps/service/Service", "kind": "application", "capability": "build", "cache": "miss", "outputs": [".struo/out/apps/service/Service/package"] }, "stderr": "" }

struo_lint_target#

Run a target's lint capability and return normalized findings.

This tool is available only when the server starts with struo mcp --allow-run. It behaves like struo lint <target> --format json: analyzer output is cached in Static Analysis Results Interchange Format, then projected into the tool-neutral struo.lint_results.v1 record. The command reports failure when warning or error findings exist, while still returning the complete finding list for repair. Native analyzer configuration remains authoritative.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Target id whose lint capability should run." } }, "required": [ "target" ] }

Example return

json
{ "target": "quality/python/lint", "capability": "lint", "exit_code": 1, "success": false, "record": { "schema": "struo.lint_results.v1", "target": "quality/python/lint", "status": "completed", "complete": true, "summary": {"total": 1, "errors": 0, "warnings": 1, "notes": 0}, "findings": [{"analyzer": "ruff", "rule_id": "F401", "severity": "warning", "message": "imported but unused"}] }, "stderr": "" }

struo_validate_actions#

Run scripted graph actions in a private validation sandbox.

Runs the same declared action analysis used by the graph, bypasses the action cache, inventories private and real-workspace filesystem changes, and returns structured input and output repairs. The matching command-line operation is struo query validate-actions <target> --capability <name>. This tool requires struo mcp --allow-run because it executes commands. On Linux (x86-64 and arm64) and macOS the probe also traces file reads: each undeclared workspace file the action tried to read becomes an undeclared_read diagnostic, and the probe stages it and reruns, so one call reports every undeclared read the action makes before it succeeds. Linux observes reads with ptrace; macOS stages the workspace's undeclared files into the private workspace, denies reads of them with Seatbelt, and collects the denials from the unified log. On Linux each action lists the files it read outside the workspace as host_reads. On macOS the trace's Seatbelt sandbox cannot nest, so a command that applies its own sandbox fails; the report then lists a limitation that says so. When the probe cannot trace reads, the action reports a trace_unavailable diagnostic and is not valid, because undeclared reads may be missing. Declared inputs that were never read are not reported, and reads that another process makes on the action's behalf, such as a daemon reached over a socket, are not observed; a socket connection is reported as a limitation.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Canonical target id." }, "capability": { "type": "string", "default": "build", "description": "Capability to validate." }, "action": { "type": "integer", "minimum": 0, "description": "Optional zero-based action index." } }, "required": [ "target" ] }

Example return

json
{"valid":false,"target":"pkg/tool","capability":"build","actions_run":1,"diagnostics":[{"code":"undeclared_write","target":"pkg/tool","attribute":"outputs","repairs":["Declare this path as an output or stop writing it"]}]}

struo_run_target#

Run a target by executing its generic run capability.

This tool is available only when the server starts with struo mcp --allow-run. It behaves like struo run <target> --format json, including prerequisite build outputs declared by the target's run capability. Argument interpretation is target-kind-specific, so inspect the target-kind schema before supplying arguments. Set visible to request a visible interface when the target kind supports one. Uncacheable actions run again instead of replaying an action-cache hit. The result includes command diagnostics under stderr and up to 64 kibibytes of each declared stdout.log or stderr.log output under captured_stdout and captured_stderr, so an agent can verify ordinary command output without a separate filesystem read. A captured field is null when the target did not declare that log.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Target id to run, such as `apps/service/Service` or `./Service`." }, "visible": { "type": "boolean", "description": "Request a visible runtime interface when the target kind supports one." }, "arguments": { "type": "array", "items": { "type": "string" }, "description": "Target-kind-specific arguments supplied to the generic run capability. Inspect the target-kind schema before setting this field." } }, "required": [ "target" ] }

Example return

json
{ "target": "apps/service/Service", "capability": "run", "exit_code": 0, "success": true, "record": { "target": "apps/service/Service", "kind": "application", "capability": "run", "cache": "bypass", "outputs": [] }, "stderr": "" }

struo_start_target#

Start a target in a persisted runtime session and return its session id.

This tool is available only when the server starts with struo mcp --allow-run. It starts the target, saves its standard output and standard error under .struo/runtime/<session_id>/, and returns immediately with the session record. Use the status, logs, and stop tools to follow the process.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "string", "description": "Target id to start, such as `tools/demo/LaunchService` or `./LaunchService`." } }, "required": [ "target" ] }

Example return

json
{ "session_id": "tools-demo-LaunchService-123-1812345678901", "target": "tools/demo/LaunchService", "status": "starting", "session_dir": ".struo/runtime/tools-demo-LaunchService-123-1812345678901", "stdout": ".struo/runtime/tools-demo-LaunchService-123-1812345678901/stdout.log", "stderr": ".struo/runtime/tools-demo-LaunchService-123-1812345678901/stderr.log" }

struo_runtime_status#

Return the latest persisted status for a runtime session.

Reads .struo/runtime/<session_id>/session.json and returns the latest status. Status values include starting, running, stopping, stopped, exited, and failed.

Input schema

json
{ "type": "object", "properties": { "session_id": { "type": "string", "description": "Session id returned by `struo_start_target`." } }, "required": [ "session_id" ] }

Example return

json
{ "session_id": "tools-demo-LaunchService-123-1812345678901", "target": "tools/demo/LaunchService", "status": "running", "pid": 4242 }

struo_runtime_logs#

Read standard output or standard error records for a runtime session.

Reads persisted line-oriented standard output and standard error records from a runtime session. Pass source to restrict the result to stdout or stderr, and pass a previous cursor to read only newer records.

Input schema

json
{ "type": "object", "properties": { "session_id": { "type": "string", "description": "Session id returned by `struo_start_target`." }, "source": { "type": "string", "enum": [ "stdout", "stderr" ], "description": "`stdout` or `stderr`." }, "cursor": { "type": "string", "description": "Cursor returned by a previous log record." }, "limit": { "type": "integer", "description": "Maximum number of records to return." } }, "required": [ "session_id" ] }

Example return

json
{ "session_id": "tools-demo-LaunchService-123-1812345678901", "records": [ { "cursor": "stdout:000000000000", "source": "stdout", "level": "info", "message": "ready" } ] }

struo_stop_runtime#

Request that a runtime session stop.

Requests that the process stop and updates the session status as the request is handled.

Input schema

json
{ "type": "object", "properties": { "session_id": { "type": "string", "description": "Session id returned by `struo_start_target`." } }, "required": [ "session_id" ] }

Example return

json
{ "session_id": "tools-demo-LaunchService-123-1812345678901", "target": "tools/demo/LaunchService", "status": "stopping" }

struo_validate_workspace#

Validate the complete workspace graph before execution.

Loads every manifest and target kind schema, then checks target attributes, target-valued attribute references, duplicate target identifiers, missing dependencies, dependency visibility, dependency provider compatibility, source patterns, and dependency cycles. Returns stable diagnostics with target and attribute scope plus suggested repairs. Call this after materializing a starter or applying edits and before build, run, or test. The matching command-line operation is struo query validate-workspace.

Input schema

json
{ "type": "object", "properties": {} }

Example return

json
{ "valid": false, "target_count": 1, "diagnostics": [ { "code": "missing_dependency", "message": "target `apps/service/Service` depends on missing target `packages/core/Core`", "target": "apps/service/Service", "attribute": "deps", "repairs": ["Declare target `packages/core/Core` or remove it from `deps`"] } ] }

struo_validate_target#

Validate a proposed [[target]] table against its target kind schema. Returns structured diagnostics instead of prose.

Schema-only validation: checks that the target declares a known target kind, every named dependency role is declared by that kind, every required attribute is present, every declared attribute is known and has the declared type, and the target name is well-formed. The check is local; it does not resolve dependency references or read other manifests. Returns { valid: true } on success or { valid: false, diagnostics: [...] } where each diagnostic carries a stable code, the offending target id, the offending attribute when applicable, and repairs an agent can apply.

Input schema

json
{ "type": "object", "properties": { "target": { "type": "object", "description": "Raw `[[target]]` table shape with `name`, `kind`, optional `deps`, `dependencies`, `srcs`, and `attrs`." } }, "required": [ "target" ] }

Example return

json
{ "valid": false, "diagnostics": [ { "code": "missing_required_attr", "message": "target kind `library` requires attribute `visibility`", "target": "Core", "attribute": "visibility" } ] }

struo_apply_edit#

Apply a batch of create / update / delete operations to one struo.toml atomically.

Reads the manifest at <workspace>/<package>/struo.toml and applies the operations only if every operation succeeds. Returns { applied: true, changed: <bool>, path: <manifest path> } on success. changed is false when the requested state already exists, in which case no manifest is written. Returns { applied: false, diagnostics: [...] } with the structured diagnostic shape used by struo_validate_target when the edit is invalid. A failed batch leaves the original file unchanged.

Input schema

json
{ "type": "object", "properties": { "package": { "type": "string", "description": "Package directory relative to the workspace root, such as `packages/core`. Use `\"\"` for the root manifest." }, "operations": { "type": "array", "description": "Ordered list of operations. Each is `{ op: \"create\", target: {...} }`, `{ op: \"update\", target_name: \"...\", set: {...} }`, or `{ op: \"delete\", target_name: \"...\" }`.", "items": { "type": "object" } } }, "required": [ "package", "operations" ] }

Example return

json
{ "applied": true, "changed": true, "path": "packages/core/struo.toml" }