Skip to content

Support appending to the MCP server instructions, not just replacing them - #12

Open
agent-qv wants to merge 1 commit into
Combodo:masterfrom
agent-qv:pr/instructions-addendum
Open

agent-qv wants to merge 1 commit into
Combodo:masterfrom
agent-qv:pr/instructions-addendum

Conversation

@agent-qv

@agent-qv agent-qv commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Closes #11

Problem

instructions: in config/packages/mcp.yaml is a single scalar. A deployment that
wants to add its own operating rules (data quality, duplicate-ticket handling, local
workflow rules — anything that spans several tools and belongs in server instructions
rather than repeated tool docblocks) currently has no way to add to the base text
without copying it wholesale into their own fork's config. Every wording change made
here then has to be manually re-merged by hand on the fork side, or drifts silently out
of sync.

Solution

Adds an optional APP_INSTRUCTIONS_ADDENDUM_FILE env var, empty by default (no behavior
change for existing deployments). When set to a path relative to the project directory,
its content is appended to the configured instructions when the server is built. It's
meant to be set in .env.local (or the deployment's own environment), pointing at a file
the deployment owns — no tracked file needs editing.

iTopBuilder::setInstructions() now stores the base value instead of forwarding it
immediately to the underlying builder, and build() appends the addendum (if any) right
before building the server — the same pattern getDiscoveryDirs() already uses to defer
its own computation to build time.

Testing

Verified via a real /_mcp initialize request, both with the env var unset (base text
only, unchanged) and set to a test file (base + addendum, correctly concatenated).
Existing test suite passes/fails identically before and after (pre-existing failures are
unrelated fixture/environment issues).

…ENDUM_FILE

instructions: in mcp.yaml is a single scalar. A deployment that wants to add
its own operating rules (data quality, duplicate-ticket handling, local
workflow rules) currently has no way to add to the base text without copying
it wholesale into a fork's own config - every wording change made here then
has to be manually re-merged by hand, or drifts silently out of sync.

Adds an optional APP_INSTRUCTIONS_ADDENDUM_FILE env var (empty by default, no
behavior change). When set to a path relative to the project dir, its content
is appended to the configured instructions when the server is built. Meant to
be set in .env.local (or the deployment's own env), pointing at a file the
deployment owns - no tracked file needs editing.

iTopBuilder::setInstructions() now stores the base value instead of forwarding
it immediately, and build() appends the addendum (if any) right before
building the server - mirroring how getDiscoveryDirs() already defers its own
computation to build() time.
Copilot AI balanced review requested due to automatic review settings September 1, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds deployment-specific MCP instruction addenda while preserving upstream base instructions.

Changes:

  • Adds optional addendum-file environment configuration.
  • Defers instruction assembly until server build time.
  • Appends readable, non-empty addendum content.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.env Defines the optional addendum file variable.
config/services.yaml Injects addendum configuration into the builder.
src/Capability/iTopBuilder.php Loads and appends addendum instructions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +120 to +123
if (!is_file($path) || !is_readable($path)) {
return $this->instructions;
}
$addendum = trim(file_get_contents($path));
if ($addendum === '') {
return $this->instructions;
}
return trim((string)$this->instructions)."\n\n".$addendum;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending review

Development

Successfully merging this pull request may close these issues.

Support appending to the MCP server instructions, not just replacing them

3 participants