Chapter 14 Β· Operate
Extending the Server
Add new capabilities without weakening the design. The same discipline applies to every new tool: narrow scope, typed arguments, trimmed responses, tests. Then learn how to port the whole pattern to a different system.
π― What you'll be able to do
- Add a new Jira read tool the safe way
- Add a write tool with confirmation and compact responses
- Port the pattern to another enterprise system while keeping the safe parts
Add a new Jira read tool
- Add a method to
JiraClient. - Request only required Jira fields.
- Add or reuse a Pydantic response model.
- Add a tool wrapper in
app/tools/__init__.py. - Add unit tests.
- Validate with MCP Inspector.
| New capability | Preferred tool shape |
|---|---|
| Get issue comments | jira_get_comments(issue_key, max_results=10) |
| List boards | jira_list_boards(project_key="") |
| Get sprints | jira_get_sprints(board_id, state="active") |
Add a new Jira write tool
For write tools:
- Keep the operation narrow.
- Require explicit identifiers.
- Return a compact confirmation.
- Do not hide permission failures.
- Consider whether Copilot Studio should require user confirmation before invoking it.
β Good write response
- JSON
{ "key": "PROJ-123", "updated": true }
β Bad write response
- JSON
{ "raw": "...entire Jira response..." }
Port the pattern to another system
Replace the system-specific layers:
| Current layer | Replace with |
|---|---|
app/jira/client.py | Client for your system. |
app/jira/trim.py | Response shaping for your system. |
| Atlassian scopes | OAuth scopes for your system. |
| Atlassian accessible resources | Equivalent tenant/site/resource discovery. |
| Jira tools | Domain-specific tools. |
- FastMCP server structure
- request-scoped token context
- middleware pattern
- APIM gateway and Key Vault-backed gateway secret
- payload trimming discipline
- tests, connector shape, Dockerfile, and CI patterns
π οΈ Mini-project: Design jira_get_comments end to end
Sketch the full change for a jira_get_comments read tool: the new JiraClient method and its Jira endpoint, the fields you'd request, a compact comment model (author, created, trimmed body), the capped max_results, the tool wrapper with a clear docstring, and two unit tests (happy path + a 404). You don't have to run it β just produce the design and check it against the read-tool steps above.
β Concept check
When porting to a system that returns very large records, which single reused layer prevents the most production incidents, and why?
π Chapter summary
- Read tool: add a client method, request only needed fields, reuse a model, add a wrapper, test, verify with Inspector.
- Write tool: keep it narrow, require explicit identifiers, return a compact confirmation, never hide permission failures.
- Porting: replace the system-specific layers; keep FastMCP structure, token context, middleware, APIM, Key Vault, trimming, tests, connector, and Dockerfile.