Prompts library

The API Agent prompts library provides a comprehensive guide on using prompts to complete various tasks.

Guidelines for using prompts

To achieve accurate and efficient results, follow these guidelines when entering prompts:

  1. Avoid words or tone that convey sarcasm or humor, as they can be misinterpreted.
  2. Use active voice, correct grammar, spelling, and keep your request clear and specific.
  3. Provide clear context and relevant keywords, and avoid vague or domain-specific terms. For example, generate test or build API.
  4. If the system cannot understand your request, it offers suggestions for alternative requests.

Prerequisites

Ensure the following before using API Agent prompts:

  • Log in to API Agent. For login and operation instructions, see Getting started.
  • You must have valid permissions to use API Agent. For more information, see API Agent user roles.
  • Ensure you have the same permissions through the API Connect's API Manager interface. Actions fail if permissions do not match.

Usage of prompts for different cases

The following table explains the prompts and its usage for different actions.

Action Prompt Description
Generating test cases Generate test cases for the API
Generate test cases for <pulbished api name>
  • Check that the API is published before you generate test cases for it. For more information, see Creating and publishing draft API.
  • API Agent connects to smart generation feature of test module, which creates test cases iteratively for the first 15 endpoints in the available API file. The test cases are stored in a test suite that is suffixed withAA_Test_Suite along with api name (AA_Test_Suite_<api_name>).
  • After generation is completed, API Agent displays the status message that shows the number of test cases that are created and the name of the test suite where they were created.
  • You can find the generated test cases in the Test module of the API Manager console.
Running test cases Run test cases for the API
Run test cases for <pulbished api name>
Note: The <published api name> must contain the name of the API. Do not combine the version information. For example, petstore.
  • You can use to run test cases for a published API in Visual Studio Code, including initiating the test, viewing results, and optionally deleting a test case.
  • The Smart Generation feature of theAPI Agent test module generates the data for input parameters to run the test. The API Agent displays the status message and the URLs of test results in Visual Studio Code after runs are initiated successfully.

Deleting test cases
delete test case <test_name> in suite <suite_name>
Click the hyperlink to view the results of the individual test cases in the API Manager console.
Listing test suites
List test suites
You can use to list test suits. Also, you can delete a test suite by entering a prompt with the suite name.
Deleting test suite
delete test suite <suite_name>
Listing test cases
List test cases for test suite <test suite name>
  • You can use to list test cases corresponding to a test suite.
  • Ensure that the test suites are available. If not available, follow the steps that are mentioned in the Generating test cases row.
  • To identify the available test suites, see the Listing test suites row.
Creating an OpenAPI
  • To create an API specification for orders table
    create openapi for orders table
    or
    generate api spec for orders table
    Note: The database must not contain another table with the same name in any other schema, as this situation might cause confusion.
  • To create an API specification for orders table
    create openapi for orders table with schema_name as purchase_order
    Or
    create openapi for orders table in purchase_order schema
  • To create an API specification for orders table by using object name and without schema name
    create openapi for orders table with object_name as purchase_order_orders
  • To create an API specification for orders table by using source ID
    create openapi for orders table with source_id as
        6c115670-a7e1-11ef-b576-fa5e88d5392d
  • To extract the OpenAPI specification for the table name and transforms to code generator-specific format
    Extract the openapi spec for the given table name and transforms to Code generator specific format
The following are the examples of prompts that you can use to create an Open API.
Generating code
  • To generate code for a simple server type
    Generate some Python FastAPI server code based on the following openapi @my_file.yaml
    Or
    Please build FastAPI backend code using the OpenAPI file @api_spec.yaml
    Or
    Can you develop a Python FastAPI server using the openapi specification provided in @service_definition.json
  • To generate code for a database create, retrieve, update, and delete server type
    Generate some Python FastAPI server code based on the following openapi @my_file.yaml that handles database operations
    Or
    Can you develop a database driven Python FastAPI server using the openapi specification provided in @service_definition.json
    Note: see
    Note: To know more information about usage of prompts by using OpenAPI Python Generator tool, see OpenAPI Python Generator tool.
Generates FastAPI server code based on OpenAPI specification.
MCP server actions
  • To view the list of enabled servers
    List me all the MCP servers that are currently enabled
    Or
    List all available MCP servers
  • To get the details of the MCP server
    Fetch the details of GitHub™ MCP server
  • To update the MCP server
    Update the enabled MCP server gitlab™ with updated deployed url [Add URL]
  • To disable the MCP server from GitHub
    Remove the github™ MCP server from the enabled tools
  • To retrieve detailed information about a specific MCP server
    Fetch details of the mcp server postman™
    or
    Show me the configuration details for the github™ MCP server
    Or
    Get information about the weather MCP server
  • To check whether an MCP server exists or not
    Check the existence of mcp server Github™
    Or
    check availability of mcp server postman™
    Or
    check if postman™ mcp server is available
Use the following prompts to do the following actions with the MCP server:
  • List of enabled servers
  • Server details
  • Update
  • Disable
  • Details about a specific MCP server
  • Check existence of MCP server

Sequential prompts

Use API Agent to chain multiple tools together in a single prompt and then run one after another. The following are examples of sequential prompts:
Create and run test cases
create test cases for the petstore api and run the test cases

List draft or published APIs or products
list draft apis, draft products, published apis and published products
Or
list published apis

Create a draft API and generate FastAPI server code
create draft api from file @openapi.yaml and generate fastapi server code from the same api file
Or
create draft api using @file_name
Review security of an API
review security of api API_NAME:VERSION
Or
validate api API_NAME:VERSION