Open Context Protocol is live! 🚀 Read the launch post
listAvailablePhoneNumberMachineToMachine

listAvailablePhoneNumberMachineToMachine

Available machine-to-machine phone numbers

Details

  • Method: GET
  • Path: /2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/MachineToMachine.json
  • Operation ID: ListAvailablePhoneNumberMachineToMachine

Parameters

{
  "AccountSid": {
    "description": "The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "CountryCode": {
    "description": "The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country from which to read phone numbers.",
    "required": true,
    "location": "path",
    "type": "string",
    "format": "iso-country-code"
  },
  "AreaCode": {
    "description": "The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada.",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "Contains": {
    "description": "Matching pattern to identify phone numbers. This pattern can be between 2 and 16 characters long and allows all digits (0-9) and all non-diacritic latin alphabet letters (a-z, A-Z). It accepts four meta-characters: `*`, `%`, `+`, `$`. The `*` and `%` meta-characters can appear multiple times in the pattern. To match wildcards at the beginning or end of the pattern, use `*` to match any single character or `%` to match a sequence of characters. If you use the wildcard patterns, it must include at least two non-meta-characters, and wildcards cannot be used between non-meta-characters. To match the beginning of a pattern, start the pattern with `+`. To match the end of the pattern, append the pattern with `$`. These meta-characters can't be adjacent to each other.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "SmsEnabled": {
    "description": "Whether the phone numbers can receive text messages. Can be: `true` or `false`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "MmsEnabled": {
    "description": "Whether the phone numbers can receive MMS messages. Can be: `true` or `false`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "VoiceEnabled": {
    "description": "Whether the phone numbers can receive calls. Can be: `true` or `false`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "ExcludeAllAddressRequired": {
    "description": "Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "ExcludeLocalAddressRequired": {
    "description": "Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "ExcludeForeignAddressRequired": {
    "description": "Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "Beta": {
    "description": "Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "NearNumber": {
    "description": "Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "phone-number"
  },
  "NearLatLong": {
    "description": "Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "Distance": {
    "description": "The search radius, in miles, for a `near_` query.  Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada.",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "InPostalCode": {
    "description": "Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "InRegion": {
    "description": "Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "InRateCenter": {
    "description": "Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "InLata": {
    "description": "Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "InLocality": {
    "description": "Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "FaxEnabled": {
    "description": "Whether the phone numbers can receive faxes. Can be: `true` or `false`.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "PageSize": {
    "description": "How many resources to return in each list page. The default is 50, and the maximum is 1000.",
    "required": false,
    "location": "query",
    "type": "integer",
    "format": "int64"
  },
  "Page": {
    "description": "The page index. This value is simply for client state.",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "PageToken": {
    "description": "The page token. This is provided by the API.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "title": "ListAvailablePhoneNumberMachineToMachineResponse",
  "type": "object",
  "properties": {
    "available_phone_numbers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "friendly_name": {
            "type": "string",
            "format": "phone-number",
            "nullable": true,
            "description": "A formatted version of the phone number."
          },
          "phone_number": {
            "type": "string",
            "format": "phone-number",
            "nullable": true,
            "description": "The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number."
          },
          "lata": {
            "type": "string",
            "nullable": true,
            "description": "The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada."
          },
          "locality": {
            "type": "string",
            "nullable": true,
            "description": "The locality or city of this phone number's location."
          },
          "rate_center": {
            "type": "string",
            "nullable": true,
            "description": "The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada."
          },
          "latitude": {
            "type": "number",
            "nullable": true,
            "description": "The latitude of this phone number's location. Available for only phone numbers from the US and Canada."
          },
          "longitude": {
            "type": "number",
            "nullable": true,
            "description": "The longitude of this phone number's location. Available for only phone numbers from the US and Canada."
          },
          "region": {
            "type": "string",
            "nullable": true,
            "description": "The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada."
          },
          "postal_code": {
            "type": "string",
            "nullable": true,
            "description": "The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada."
          },
          "iso_country": {
            "type": "string",
            "format": "iso-country-code",
            "nullable": true,
            "description": "The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number."
          },
          "address_requirements": {
            "type": "string",
            "nullable": true,
            "description": "The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required."
          },
          "beta": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the phone number is new to the Twilio platform. Can be: `true` or `false`."
          },
          "capabilities": {
            "type": "object",
            "format": "phone-number-capabilities",
            "x-class-extra-annotation": "@JsonInclude(JsonInclude.Include.NON_NULL)",
            "properties": {
              "mms": {
                "type": "boolean"
              },
              "sms": {
                "type": "boolean"
              },
              "voice": {
                "type": "boolean"
              },
              "fax": {
                "type": "boolean"
              }
            },
            "nullable": true,
            "description": "The set of Boolean properties that indicate whether a phone number can receive calls or messages.  Capabilities are: `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`."
          }
        }
      }
    },
    "end": {
      "type": "integer"
    },
    "first_page_uri": {
      "format": "uri",
      "type": "string"
    },
    "next_page_uri": {
      "format": "uri",
      "nullable": true,
      "type": "string"
    },
    "page": {
      "type": "integer"
    },
    "page_size": {
      "type": "integer"
    },
    "previous_page_uri": {
      "format": "uri",
      "nullable": true,
      "type": "string"
    },
    "start": {
      "type": "integer"
    },
    "uri": {
      "format": "uri",
      "type": "string"
    }
  }
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('twilio')

# Call this tool
result = await agent.call_tool('listAvailablePhoneNumberMachineToMachine', {
    # Add required parameters here
})