Skip to main content
Glama

decline_thread

Cancel or decline a conversation thread on the402.ai marketplace. Agents or providers can use this to stop ongoing service requests, with potential refunds if work hasn't begun.

Instructions

Cancel or decline a thread on the402.ai. Either the agent or provider can use this. If payment was made and work hasn't started, a refund may be issued. Requires API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thread_idYesThe thread ID to decline/cancel
reasonNoOptional reason for declining

Implementation Reference

  • The `decline_thread` tool is defined here using `server.tool` in `src/tools/threads.ts`. It registers the tool with the MCP server, defines its schema, and implements the handler logic which makes a POST request to the `/v1/threads/{thread_id}/decline` endpoint.
    server.tool(
    	"decline_thread",
    	"Cancel or decline a thread on the402.ai. Either the agent or provider can use this. If payment was made and work hasn't started, a refund may be issued. Requires API key.",
    	{
    		thread_id: z.string().describe("The thread ID to decline/cancel"),
    		reason: z.string().optional().describe("Optional reason for declining"),
    	},
    	async ({ thread_id, reason }) => {
    		const body: Record<string, unknown> = {};
    		if (reason) body.reason = reason;
    		const result = await client.authPost(
    			`/v1/threads/${thread_id}/decline`,
    			body
    		);
    		return {
    			content: [
    				{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    			],
    		};
    	}
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/the402ai/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server