Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions src/oci-api-mcp-server/oracle/oci_api_mcp_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,43 @@ def get_oci_commands() -> str:
@mcp.tool
def get_oci_command_help(command: str) -> str:
"""Returns helpful instructions for running an OCI CLI command.
Only provide the command after 'oci', do not include the string 'oci'
in your command.

Never use the information returned by this tool to tell a user what
to do, only use it to help you determine which command to run yourself
using the run_oci_command tool.

CLI commands are structured as <service> <resource> <action>; you can get
help at the service level, resource level or action level, respectively:
1. compute
2. compute instance
3. compute instance list

If your request for help for a specific command
returns an error, make your requests successively less specific;
example:
1. compute instance list
2. compute instance
3. compute
IMPORTANT:
- Only provide the command _after_ 'oci' — do not include the string
'oci' in `command`.
- Never use the information returned by this tool to instruct an end
user directly. Use it only to determine which command to run
yourself using run_oci_command.

Command structure guidance:
- OCI subcommands are organized as:
<service> <subcommand> <subcommand> ...
e.g.
compute instance list OR
compute instance action-name OR
recovery protected-database-collection list-protected-databases
- Services vary in how they structure their CLI. Some use
explicit resource tokens (compute instance list), others use
collection names or hyphenated actions
(e.g. list-protected-databases),
and some have deeper subcommand chains (service sub1 sub2 sub3 ...).

How to ask for help:
- Start with the most specific form you think is correct, for example:
compute instance list
compute instance action-name
recovery protected-database-collection list-protected-databases
- If the specific request returns an error, progressively make it
less specific:
1. try the full command (most specific)
2. remove the final token and try again
3. repeat until you reach just the service name (e.g. compute)
- Additionally, if a service commonly uses hyphenated commands for
list operations, try hyphenated forms as well
e.g.
recovery protected-database list-protected-databases OR
psql db-system-collection list-db-systems.

"""
logger.info(f"get_oci_command_help called with command: {command}")
env_copy = os.environ.copy()
Expand Down