Skip to content

Add schema description, enum values to tool description #50

@logan-querypie

Description

@logan-querypie

When the parameter of an OpenAPI specification is an enum, it is recommended to add the enum values to the parameter description in the MCP tool. This ensures that appropriate parameters are input into MCP.

Furthermore, since both parameter.description and parameter.schema.description exist, it is advisable to include both in the tool's description.

For example, modify the tool definition of "zone" in openapi.json as follows:

before

  {
     "name":"zone",
     "description":"Returns metadata about a given zone",
     "inputSchema":{
        "type":"object",
        "properties":{
           "effective":{
              "description":"Effective date/time",
              "type":"string"
           },
           "type":{
              "description":"Zone type",
              "type":"string"
           },
           "zoneId":{
              "description":"NWS public zone/county identifier",
              "pattern":"^(A[KLMNRSZ]|C[AOT]|D[CE]|F[LM]|G[AMU]|I[ADLN]|K[SY]|L[ACEHMOS]|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[AHKMRSWZ]|S[CDL]|T[NX]|UT|V[AIT]|W[AIVY]|[HR]I)[CZ]\\d{3}$",
              "type":"string"
           }
        },
        "required":[
           "type",
           "zoneId"
        ]
     }
  },

after

  {
     "name":"zone",
     "description":"Returns metadata about a given zone",
     "inputSchema":{
        "type":"object",
        "properties":{
           "effective":{
              "description":"Effective date/time",
              "type":"string"
           },
           "type":{
              "description":"Zone type (Allowed values: land, marine, forecast, public, coastal, offshore, fire, county)",
              "type":"string"
           },
           "zoneId":{
              "description":"NWS public zone/county identifier. UGC identifier for a NWS forecast zone or county.\nThe first two letters will correspond to either a state code or marine area code (see #/components/schemas/StateTerritoryCode and #/components/schemas/MarineAreaCode for lists of valid letter combinations).\nThe third letter will be Z for public/fire zone or C for county.\n",
              "pattern":"^(A[KLMNRSZ]|C[AOT]|D[CE]|F[LM]|G[AMU]|I[ADLN]|K[SY]|L[ACEHMOS]|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[AHKMRSWZ]|S[CDL]|T[NX]|UT|V[AIT]|W[AIVY]|[HR]I)[CZ]\\d{3}$",
              "type":"string"
           }
        },
        "required":[
           "type",
           "zoneId"
        ]
     }
  },

I'll submit a pr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions