Skip to content
MCP

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

  1. Add a method to JiraClient.
  2. Request only required Jira fields.
  3. Add or reuse a Pydantic response model.
  4. Add a tool wrapper in app/tools/__init__.py.
  5. Add unit tests.
  6. Validate with MCP Inspector.
New capabilityPreferred tool shape
Get issue commentsjira_get_comments(issue_key, max_results=10)
List boardsjira_list_boards(project_key="")
Get sprintsjira_get_sprints(board_id, state="active")

Add a new Jira write tool

For write tools:

  1. Keep the operation narrow.
  2. Require explicit identifiers.
  3. Return a compact confirmation.
  4. Do not hide permission failures.
  5. 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 layerReplace with
app/jira/client.pyClient for your system.
app/jira/trim.pyResponse shaping for your system.
Atlassian scopesOAuth scopes for your system.
Atlassian accessible resourcesEquivalent tenant/site/resource discovery.
Jira toolsDomain-specific tools.
Keep these β€” they're the valuable part
  • 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.

βœ… End-of-chapter review

0/3 done