# Generate coordinated improvements
optimized_prompt, optimized_tools = joint_optimization(
    interactions=interactions,
    current_prompt=your_system_prompt,
    current_tools=your_tool_descriptions
)
```

### Step 4: Update your tool documentation

Apply the optimized descriptions to your tool documentation, depending on how your tools are defined.

For example, if your tools are part of a [Gram-hosted MCP server](/docs/gram/introduction), update tool descriptions in the Gram admin interface or directly in the OpenAPI documents.

### Step 5: Validate improvements

Test your optimized agent with the same queries to measure improvements.

## Example: TODO MCP server hosted by Gram

As an example, we tested the joint optimization framework on a TODO MCP server hosted by Gram. Here's the step-by-step process we followed, including the results we obtained.

### Step 1: Initial server setup

We started with a basic TODO API hosted on Gram with these generic tool descriptions:

- `listTodos`: "List all todos"
- `createTodo`: "Create a new todo"
- `updateTodo`: "Update a todo"
- `deleteTodo`: "Delete a todo"

The OpenAPI document contained minimal descriptions that provided no parameter guidance or usage examples.

### Step 2: Connect the optimization agent

We created a simple Python agent that connects to the Gram MCP server:

```python
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP

agent = Agent(
    model='gpt-4o-mini',
    system_prompt="You help users manage their todo lists efficiently.",
    toolsets=[
        MCPServerStreamableHTTP(
            url="https://app.getgram.ai/mcp/todo-example"
        )
    ]
)
```

### Step 3: Collect baseline performance data

We tested the agent with realistic user queries:

```python
test_queries = [
    "Add 'Buy groceries' to my todo list",
    "Show me all my todos",
    "Add 'Call dentist' to my todos",
    "Mark the first todo as completed",
    "Show me my todos again",
    "Delete the completed todo"
]
```

Here are the baseline results:

- **Success rate:** 83.3% (5 out of 6 queries succeeded)
- **Average response time:** 8.36 seconds
- **CAPR score:** 0.833
- **Key failure:** The delete operation failed because the agent couldn't determine which todo to delete without specific ID guidance

### Step 4: Run the optimization analysis

Using the Bloomberg team's joint optimization framework, we analyzed the interaction data:

```python