get_channel
Retrieve channel details by specifying a channel ID to manage e-commerce fulfillment operations through the ShipBob API MCP Server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | The ID of the channel to retrieve |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"channelId": {
"description": "The ID of the channel to retrieve",
"type": "string"
}
},
"required": [
"channelId"
],
"type": "object"
}
Implementation Reference
- src/tools/channel-tools.js:32-47 (handler)The asynchronous handler function that implements the core logic of the 'get_channel' MCP tool. It takes a channelId parameter, fetches the channel details from the ShipBob API client, and returns a formatted JSON response or an error message.handler: async ({ channelId }) => { try { const channel = await shipbobClient.getChannel(channelId); return { content: [{ type: "text", text: JSON.stringify(channel, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving channel: ${error.message}` }], isError: true }; } }
- src/tools/channel-tools.js:29-31 (schema)Zod schema defining the input validation for the 'get_channel' tool, specifying a required string 'channelId' parameter.schema: { channelId: z.string().describe("The ID of the channel to retrieve") },
- src/server.js:57-57 (registration)Registration of the channelTools array (containing 'get_channel') with the MCP server's registerTools function.registerTools(channelTools);
- src/server.js:23-32 (registration)The registerTools function that iterates over tool arrays and calls server.tool() to register each MCP tool, including 'get_channel'.const registerTools = (toolsArray) => { toolsArray.forEach(tool => { server.tool( tool.name, tool.schema, tool.handler, { description: tool.description } ); }); };
- src/api-client.js:158-160 (helper)ShipBobClient method getChannel(id) that performs the API request to retrieve specific channel details, called by the tool handler.async getChannel(id) { return this.request('GET', `/channels/${id}`); }