Home / Directory / Apollo GraphOS / PublishContract
PublishContract
An MCP tool from the Apollo GraphOS server, run by Apollo.
Create or update a contract variant and start a launch for it, the same write that `rover contract publish` performs. A contract variant is a filtered view of another variant's schema, built by including and excluding schema elements by tag. The filter configuration replaces the previous one in full, so send the complete include and exclude lists rather than only the tags you want to change. The same applies to hideUnreachableTypes, which has no default: when you update a contract, pass the value it has now. GetContractConfig states that value in its description. Returns the contract variant and a link to the launch, or the error messages that stopped it. Provide the graph ID, the contract variant name, the source variant, the include and exclude tag lists, and whether to hide unreachable types.
Name on the gateway: apollo_graphos__PublishContract.
Parameters
| Name | Type | Description |
|---|---|---|
graphId required | string | |
contractVariant required | string | The name of the contract variant, e.g. `public-api`. Once set, this value cannot be changed. |
sourceVariant | mixed | The graphRef of the variant the contract will be derived from, e.g. `my-graph@production`. Once set, this value cannot be changed. |
include required | array | |
exclude required | array | |
hideUnreachableTypes required | boolean | |
initiateLaunch | mixed | Whether a launch and schema publish should be initiated after updating configuration. Defaults to `true`. |
How to call it
Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:
{
"name": "apollo_graphos__PublishContract",
"arguments": {
"graphId": "…",
"contractVariant": "…",
"include": [],
"exclude": [],
"hideUnreachableTypes": true
}
}The first call connects Apollo GraphOS to your account automatically; nothing to set up. About this server.
Try asking
Use the publishcontract tool with graphId set to ….